 # Contiguous Cake Cutting: Hardness Results and Approximation Algorithms

We study the fair allocation of a cake, which serves as a metaphor for a divisible resource, under the requirement that each agent should receive a contiguous piece of the cake. While it is known that no finite envy-free algorithm exists in this setting, we exhibit efficient algorithms that produce allocations with low envy among the agents. We then establish NP-hardness results for various decision problems on the existence of envy-free allocations, such as when we fix the ordering of the agents or constrain the positions of certain cuts. In addition, we consider a discretized setting where indivisible items lie on a line and show a number of hardness results strengthening those from prior work.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

We consider the classical cake cutting problem, where we wish to divide a cake among a set of agents with different preferences over different parts of the cake. The cake serves as a metaphor for any divisible resource such as time or land, and our aim is to perform the division in a fair manner. This problem has a long and storied history that dates back over 70 years and has received attention from mathematicians, economists, and computer scientists alike (Brams and Taylor, 1996; Robertson and Webb, 1998; Procaccia, 2016).

In order to reason about fairness, we need to specify when a division is considered to be fair. One of the most commonly used definitions is envy-freeness, which means that no agent envies another with respect to the division. In other words, among the pieces in the division, every agent receives their first choice. An early result by Dubins and Spanier (1961) shows that an envy-free allocation always exists for arbitrary valuations of the agents. However, as Stromquist (1980) noted, this result depends on a liberal definition of what constitutes a piece of cake, and an agent “who hopes only for a modest interval of cake may be presented instead with a countable union of crumbs.”

In light of this concern, Stromquist (1980) strengthened the result of Dubins and Spanier by showing that it is possible to guarantee an envy-free allocation in which every agent receives a contiguous piece of the cake. Stromquist’s result, together with its topological proof, is widely regarded as a cornerstone of the cake cutting literature. Nevertheless, since the result focuses only on the existence of a contiguous envy-free allocation, it leaves open the question of how to compute such an allocation. Almost 30 years later, Stromquist himself addressed this question and showed that under the Robertson-Webb model, where an algorithm is allowed to discover the agents’ valuations through cut and evaluate queries, no finite algorithm can compute a contiguous envy-free allocation when there are at least three agents (Stromquist, 2008).111For two agents, the well-known cut-and-choose protocol, which lets the first agent cut the cake into two equal pieces and lets the second agent choose the piece that she prefers, computes a contiguous envy-free allocation.

Although Stromquist’s later result rules out the possibility of computing contiguous envy-free allocations in general, several important questions still remain. For instance, can we compute a contiguous allocation with low envy between the agents, and if so, how efficiently? How does the answer change if we know that the agents’ valuations belong to a restricted class? What happens if we add extra requirements on the allocation, such as fixing a desired ordering of the agents or constraining the positions of certain cuts? The goal of this paper is to shed light on the complexity of contiguous cake cutting by addressing these questions.

### 1.1 Our Contributions

First, in Section 3 we present two algorithms that compute an allocation with low envy in polynomial time. As is standard in the cake-cutting literature, we represent the cake by the interval and normalize the agents’ valuations so that each agent has value for the entire interval. Our first algorithm works for general valuations under the Robertson-Webb model and produces a contiguous allocation in which any agent has envy no more than towards any other agent. On the other hand, our second algorithm is specific to valuations where each agent only desires a single subinterval and has a uniform value over that interval—for such valuations, the algorithm produces a contiguous allocation with a lower envy of at most .

Next, in Section 4, we consider variants of the cake-cutting problem where we impose constraints on the desired allocation. We show that for several natural variants, the decision problem of whether there exists a contiguous envy-free allocation satisfying the corresponding constraints is NP-hard. In particular, this holds for the variants where (i) a certain agent must be allocated the leftmost piece; (ii) the ordering of the agents is fixed; and (iii) one of the cuts must fall at a given position. Fixing the ordering of the agents is relevant when there is a temporal ordering in which the agents must be served, e.g., due to notions of seniority or the ease of switching from one agent to another in the service. Likewise, fixing a cut point is applicable when we divide a parcel of land and there is a road crossing the parcel, so we cannot allocate a piece that lies on both sides of the road. Moreover, our construction serves as a general framework that can be used to obtain hardness results for other related variants.

Finally, in Section 5 we investigate a discrete analog of cake cutting, where there are indivisible items on a line and each agent is to be allocated a contiguous block of items. The discrete setting can be viewed as a type of restriction for the continuous setting, where cuts must be placed between discrete items. In addition to envy-freeness, we work with two other well-studied fairness notions: proportionality and equitability.222See the definitions in Section 5. Using a single reduction, we show that deciding whether there exists a contiguous fair allocation is NP-hard for each of the three fairness notions as well as any combination of them; our result holds even when all agents have binary valuations333That is, the valuations are additive and each agent values each item either or . and moreover value the same number of items. This significantly strengthens a result of Bouveret et al. (2017), who established the hardness for proportionality and envy-freeness using additive but non-binary valuations. In addition, we prove that when the valuations are binary and every agent values a contiguous block of items, deciding whether a contiguous proportional allocation exists is also NP-hard.

### 1.2 Further Related Work

Since the seminal work of Stromquist (1980, 2008), a number of researchers have studied cake cutting in view of the contiguity condition. Su (1999) proved the existence of contiguous envy-free allocations using Sperner’s lemma arguments. Deng, Qi, and Saberi (2012) showed that contiguous envy-free cake cutting is PPAD-complete; however, the result requires non-standard (e.g., non-additive) valuation functions. Aumann, Dombb, and Hassidim (2013) considered the problem of maximizing social welfare with contiguous pieces, while Bei et al. (2012) tackled the same problem with the added requirement of proportionality. Cechlárová and Pillárová (2012) and Cechlárová, Doboš, and Pillárová (2013) examined the existence and computation of contiguous equitable allocations—among other things, they showed that such an allocation is guaranteed to exist even if we fix the ordering of the agents. Aumann and Dombb (2015) analyzed the trade-off between fairness and social welfare in contiguous cake cutting. Segal-Halevi, Hassidim, and Aumann (2016) circumvented Stromquist (1980)’s impossibility result by presenting bounded-time contiguous envy-free algorithms that may not allocate the entire cake but guarantee every agent a certain positive fraction of their value.444Without this guarantee, it would be much easier to find a contiguous envy-free allocation—just don’t allocate any of the cake! Contiguity has recently been studied in a more general model where the cake can be represented by an arbitrary graph (Bei and Suksompong, 2019).

The contiguity requirement has also been considered in the context of indivisible items. Marenco and Tetzlaff (2014) proved that if the items lie on a line and every item is positively valued by at most one agent, a contiguous envy-free allocation is guaranteed to exist. When each item can yield positive value to any number of agents, Barrera et al. (2015), Bilò et al. (2019), and Suksompong (2019) showed that various relaxations of envy-freeness can be fulfilled. Like in cake cutting, contiguity has been studied for indivisible items in the more general model where the items lie on an arbitrary graph (Bouveret et al., 2017; Igarashi and Peters, 2019; Bei et al., 2019).

Recently, Arunachaleswaran et al. (2019) developed an efficient algorithm that computes a contiguous cake division with multiplicatively bounded envy—in particular, each agent’s envy is bounded by a multiplicative factor of . We remark that our approximation algorithms are incomparable to their result. On the one hand, their algorithm may return an allocation wherein an agent has value for her own piece and for another agent’s piece—this corresponds to an additive envy of . On the other hand, our algorithms may leave some agents empty-handed, leading to unbounded multiplicative envy. We also note that additive envy is the more commonly considered form of approximation, both for cake cutting (Deng, Qi, and Saberi, 2012; Brânzei and Nisan, 2017, 2019) and for indivisible items (Lipton et al., 2004; Caragiannis et al., 2016).

## 2 Preliminaries

For any positive integer , let . In our cake cutting setting, we consider the cake as the interval . There are agents whose preferences over the cake are represented by valuation functions . Assume that these valuation functions are non-negative density functions over . We abuse notation and let for . It follows that the valuations are non-negative, additive, and non-atomic (i.e., ). We assume further that the valuations are normalized so that for every .

A contiguous allocation of the cake is a partition of into (possibly empty) intervals, along with an assignment of each interval to an agent, so that every agent gets exactly one interval. Note that this means that we cut the cake using cuts. Formally, a contiguous allocation is represented by the cut positions and a permutation that assigns the intervals to the agents so that agent receives the interval , where we define and for convenience.

We are interested in finding a contiguous allocation that is envy-free, i.e., no agent thinks that another agent gets a better interval. Formally, the contiguous allocation is envy-free if for all , we have . In some cases we will be interested in finding a contiguous allocation that is only approximately envy-free. For , the contiguous allocation is -envy-free if for all , we have . In other words, any agent has envy that is at most a fraction of her value for the whole cake.

A typical way for an algorithm to access the valuation functions is through queries in the Robertson-Webb model: the algorithm can make evaluate queries—where it specifies and asks agent to return the value —and cut queries—where it specifies and asks agent to return the leftmost point such that . A more restrictive class of valuations is that of piecewise constant valuations. A piecewise constant valuation function is defined by a piecewise constant density function on , i.e., a step function. This class of valuations can be explicitly represented as part of the input. A subclass of piecewise constant valuations is the class of piecewise uniform valuations, where the density function of agent is either some fixed rational constant or .

## 3 Approximation Algorithms

In this section, we present two algorithms for approximate envy-free cake cutting. Algorithm 1 works for arbitrary valuations and returns a -envy-free allocation. On the other hand, Algorithm 2 can be used for piecewise uniform valuations with a single value-block and outputs a -envy-free allocation. Note that such valuations are relevant, for example, when the agents are dividing machine processing time: each agent has a release date and a deadline for her job, so she would like to maximize the processing time she obtains after the release date and before the deadline.

While Algorithm 1 can be implemented for general valuations under the Robertson-Webb model, it also allows a simple interpretation as a moving-knife algorithm. In this interpretation, the algorithm works by moving a knife over the cake from left to right. Whenever the current piece has value to at least one remaining agent, the piece is allocated to one such agent. If the knife reaches the right end of the cake, then the piece is allocated to an arbitrary remaining agent if there is at least one remaining agent, and to the agent who received the last piece otherwise.

###### Theorem 3.1.

For agents with arbitrary valuations, Algorithm 1 returns a contiguous -envy-free allocation and runs in time polynomial in assuming that it makes queries in the Robertson-Webb model.

###### Proof.

Every agent receives a single interval from the algorithm; the only possible exception is agent in line 19. However, since is chosen as the last agent removed from , the interval allocated to earlier is adjacent to , meaning that also receives a single interval. Hence the allocation is contiguous. Moreover, the algorithm only needs to make queries in lines 5, 7 and 8, and the number of necessary queries is clearly polynomial in . The remaining steps can be implemented in polynomial time.

We now prove that the envy of an agent towards any other agent is at most . If is assigned a piece in the while loop (line 5), receives value at least . This means that ’s value for any other agent’s piece is at most , so ’s envy is no more than . Alternatively, after the while loop, still has not received a piece, meaning that in line 14. By our allocation procedure in the while loop, values any piece assigned in the while loop at most . Furthermore, when the algorithm enters line 14, values the interval less than . Since is assigned to an agent who did not receive an interval earlier, it follows that does not envy any other agent more than , as claimed. ∎

Note that if we are only interested in having an algorithm that makes a polynomial number of queries, Brânzei and Nisan (2017) showed that for any , a contiguous -envy-free allocation can be found using queries, which is polynomial in for constant . Their algorithm works by cutting the cake into pieces of size and performing a brute-force search over the space of all contiguous allocations with respect to these cuts; this algorithm therefore has exponential computational complexity (even for constant ). By contrast, in the absence of the contiguity constraint, Procaccia (2016, p. 323) gave a simple polynomial-time algorithm that computes an -envy-free allocation for any constant . His algorithm also starts by cutting the cake into pieces of size and then lets agents choose their favorite pieces in a round-robin manner; consequently, the resulting allocation can be highly non-contiguous.

While we do not know whether the bound in our approximation can be improved under the computational efficiency requirement,555For the case , Deng, Qi, and Saberi (2012) gave a fully polynomial-time approximation scheme that computes a contiguous -envy-free allocation for any . we show next that if the agents have piecewise uniform valuations and each agent only values a single interval, the envy can be reduced to . Alijani et al. (2017) showed that if the valuations are as described and moreover the valued intervals satisfy an “ordering property”, meaning that no interval is a strict subinterval of another interval, then a contiguous envy-free allocation can be computed efficiently. Nevertheless, the ordering property is a very strong assumption, and indeed reducing the envy to without this assumption already requires significant care in assigning the pieces.666Alijani et al. (2017) also showed that for piecewise uniform valuations where each agent only values a single interval (without the ordering property assumption), one can efficiently compute an envy-free allocation with at most intervals in total.

At a high level, Algorithm 2 first orders the agents from shortest to longest desired interval, breaking ties arbitrarily. For each agent in the ordering, if an interval of value containing the midpoint of her valued interval (perhaps at the edge of the former interval) has not been taken, the agent takes one such interval. Else, if an interval of value is available somewhere, the agent takes one such interval; here, if there are choices on both sides of the midpoint, the agent may need to be careful to pick the “correct” one. Otherwise, if no interval of value is available, the agent takes a largest available interval. At the end of this process, part of the cake may remain unallocated. If some pair of assigned intervals are adjacent, pick one such pair, and allocate the remaining cake by extending pieces away from the border between this pair. Else, extend the pieces arbitrarily to cover the remaining cake.

###### Theorem 3.2.

For agents with piecewise uniform valuations such that each agent only values a single interval, Algorithm 2 returns a contiguous -envy-free allocation and runs in time polynomial in .

###### Proof.

One can check that Algorithm 2 assigns a single interval to every agent and can be implemented in polynomial time. It remains to show that the algorithm returns an allocation such that for any two agents , agent has envy at most towards agent . For the purpose of this proof, when we refer to an interval , we mean the interval before it is extended in the final phase of the algorithm (the extension phase starting at line 18). We denote by the corresponding extended interval that is returned by the algorithm. For any agent and any interval , the -value of is the value of for agent , i.e., .

When agent ’s turn comes in the for-loop, it falls into exactly one of four possible cases: Case 1 (line 8), Case 2 (line 10), Case 3 (line 14) or Case 4 (line 16). Depending on which case applies, is chosen accordingly. We say that the single-direction extension (SDE) property holds, if at least one agent does not fall into Case 2. It is easy to check that if the SDE property holds, then there are at least two allocated intervals and that are adjacent before the extension phase begins, and thus every interval will be extended in a single direction.

It is clear that for all . Furthermore, in all four cases it holds that agent is allocated an interval of value at most , i.e., for all . Since and because of the way the agents are ordered, it follows that

 vi(Mj)≤1/4 for all j≤i (1)

We now show that any agent has envy at most at the end of the algorithm. Namely, we prove that for any agents we have . We treat the four different cases that can occur during agent ’s turn.

Cases and . In both cases, contains and has -value . This also holds for . Since the midpoint of is contained in , any other interval has -value at most . Thus, agent has envy at most .

Case . In this case, we again have . However, this time we have , which implies that for all . Thus, it remains to show that . Since , we have . Thus, we need to show that the extension of to increases the -value by at most . Since was chosen to be adjacent to , it suffices to show that there is at most -value available on the other side of .

To this end, we prove that at the start of agent ’s turn, cannot have at least of -value available both on the left side and on the right side. Assume on the contrary that this is the case. Note, in particular, that is not restrained. Thus, was allocated in agent ’s turn by Case 2. We also know that , because and . Now there are two cases:

• If , then . But in that case, at the start of agent ’s turn, there exists a restrained interval with and . Thus, agent would have been in Case 1 instead of 3.

• If , then in agent ’s turn, Case 1 will apply. Indeed, and thus there is at least of -value available that contains (because there is enough space for of -value and ). But if Case 1 applies, then will be chosen to be adjacent to (since they both contain ), and will not have space available on both sides when agent ’s turn comes.

Case . First, suppose that . This means that was a largest available interval in . It follows that any agent can obtain an interval of -value at most , since it is processed after . For , since agent is in Case 4, the SDE property holds. Thus, can be extended by at most , i.e., for all . With (1) it follows that the envy is at most .

Now, consider the case where . Any agent can obtain -value —otherwise, agent would have fallen in Case 1 or 2. Consider any :

• if , then both on the left and right side of the space available has -value (otherwise agent would be in Case 1 or 3). Since the SDE property holds, it follows that with (1).

• if , then . Otherwise, it means that is extended in a single direction (SDE property) and takes over an interval of -value at least that contains . But then, agent would be in Case 1 or 2.

This completes the proof. ∎

## 4 Hardness for Cake-Cutting Variants

In this section, we establish hardness results for a number of decision problems on the existence of contiguous envy-free allocations.

###### Theorem 4.1.

The following decision problems are NP-hard for contiguous cake cutting, even if we restrict the valuations to be piecewise uniform:

• Does there exist an envy-free allocation in which agent obtains the left-most piece?

• Does there exist an envy-free allocation in which the pieces are allocated to the agents in the order ?

• Does there exist an envy-free allocation such that there is a cut at position , for given in the input?

These problems remain NP-hard if we replace envy-freeness by -envy-freeness for any sufficiently small constant .

This list is not exhaustive: additional results of the same flavor can be found in the full proof (Appendix A).777However, if we fix all cuts, the problem becomes solvable in polynomial time. Indeed, with all the cuts fixed, the resulting pieces are also all fixed. We can therefore construct a bipartite graph with the agents on one side and the pieces on the other side, where there is an edge between an agent and a piece exactly when receiving the piece would make the agent envy-free. The problem of determining whether an envy-free allocation exists therefore reduces to deciding the existence of a perfect matching, which can be done in polynomial time. The following proof sketch conveys the main ideas behind these results.

###### Proof Sketch.

In order to prove that these decision problems are NP-hard, we reduce from 3-sat. Namely, given a 3-sat formula, we construct a cake-cutting instance such that the answer to the decision problem is “Yes” if and only if the 3-sat formula is satisfiable. A bonus of our proof is that we construct a single cake-cutting instance that works for all of the decision problems mentioned in the Theorem statement and even a few more.

Let us give some insight into how this instance is constructed. Consider a 3-sat formula , where the are clauses containing 3 literals using the variables and their negations. The cake-cutting instance is constructed by putting together multiple small cake-cutting instances, so-called gadgets. For every clause we introduce a Clause-Gadget with its three corresponding agents , and . The intuition here is that is associated to the first literal appearing in , to the second one, and to the third one. For any Clause-Gadget agent , we let denote the associated literal. The valuations of these agents inside the gadget are as shown in Figure 1. We say that the gadget operates correctly if it contains exactly two cuts and the three resulting pieces go to the three agents , and . At this point we can already make a first key observation: if the gadget operates correctly, at least one of the three agents must be sad, i.e., obtain at most one out of its three blocks of value in this gadget.

For every variable we introduce a Variable-Gadget with its two corresponding agents and . Apart from these two agents, some Clause-Gadget agents will also have a value-block inside this gadget. In more detail, all the Clause-Gadget agents that correspond to or will have a block of value inside the Variable-Gadget for . Figure 2 shows how the value-blocks are arranged inside the gadget. We say that the gadget operates correctly if it contains exactly one cut and the two resulting pieces go to and . There is a second key observation to be made here. Assume that all gadgets operate correctly. If some agent with (or ) is sad, then the value-block of in the Variable-Gadget for has to contain a cut (otherwise would be envious). Since the Variable-Gadget contains exactly one cut, it is impossible to have agents and with and that are both sad.

The instance is constructed by positioning the gadgets one after the other on the cake. Starting from the left and moving to the right, we first put the Clause-Gadget for , then , and so on until , and then the Variable-Gadget for , then , and so on until . Between adjacent gadgets we introduce a small interval without any value-blocks. We say that an envy-free allocation is nice if all the gadgets operate correctly.

Let us now see how a nice envy-free allocation yields a satisfying assignment for the 3-sat formula. For any agent that is sad, we set the corresponding literal to be true. This means that if , then we set to be true, and if , then we set to be false. The first key observation above tells us that every Clause-Gadget has at least one sad agent. Thus, this assignment of the variables ensures that every clause is satisfied. However, we have to make sure that this assignment is consistent, i.e., we never set to be both true and false. This consistency is enforced by the Variable-Gadget for and the second key observation above.

Conversely, given a satisfying assignment for the 3-sat formula, it is not too hard to construct a nice envy-free allocation. This proves NP-hardness for the decision problem “Does there exist a nice envy-free allocation?”. In order to prove the result for the more natural decision problems stated in Theorem 4.1, the construction has to be extended with some additional work. ∎

## 5 Hardness for Indivisible Items

We now turn to a discrete analog of cake cutting, where we wish to allocate a set of indivisible items that lie on a line subject to the requirement that each agent must receive a contiguous block. As in cake cutting, we assume that the valuations of the agents over the items are additive, and that all items must be allocated. Besides envy-freeness, we consider the classical fairness notions of proportionality and equitability. An allocation is proportional if every agent receives value at least times her value for the whole set of items, and equitable if all agents receive the same value.

Unlike in cake cutting, for indivisible items there may be no allocation satisfying any of the three fairness properties, e.g., when two agents try to divide a single item. Bouveret et al. (2017) showed that deciding whether an envy-free allocation exists is NP-hard for additive valuations, and the same is true for proportionality; they did not consider equitability. In this section, we extend and strengthen their results in several ways. We consider binary valuations, which are additive valuations such that the value of each agent for each item is either or . In other words, an agent either “wants” an item or not. Even though binary valuations are much more restrictive than additive valuations, as we will see, several problems still remain hard even for this smaller class.

First, we show that deciding whether a fair allocation exists is NP-hard for each of three fairness notions mentioned. This hardness result holds for any non-empty combination of the three notions and even if all agents want the same number of items. Moreover, we present a reduction that establishes the hardness for all combinations in one fell swoop. We remark that the techniques of Bouveret et al. (2017) do not extend to the binary domain because each agent can have different values for different items in their construction. One may try to fix this by breaking items into smaller items to obtain a binary valuation, but each agent will require a different way of breaking items, and moreover there will be allocations in the new instance that cannot be mapped back to those in the original instance.

###### Theorem 5.1.

Let

 F={envy-freeness, proportionality, equitability},

and let . Deciding whether an instance with indivisible items on a line admits a contiguous allocation satisfying all properties in is NP-hard, even if all agents have binary valuations and value the same number of items.

###### Proof.

We prove this result with a single reduction. Let be an instance of 3-SAT with clauses using the variables and their negations. We create the following gadgets.

• Clause-Gadget: For every clause we introduce three agents: . Each of these agents is associated with one of the three literals that appear in the clause . We denote by the literal associated with . For every clause we construct a Clause-Gadget. The gadget consists of four contiguous items that are all valued by all three agents , and by no one else.

• Variable-Gadget: For every variable we introduce two agents, and , and construct a Variable-Gadget as follows (Figure 3). Starting from the left, create two items that are valued by both and (and no one else). Then, create one item that is valued only by . Then, for every such that , create two items that are valued only by . Then, create an item that is valued by both and . Then, for every such that , create two items that are valued only by . Finally, create an item that is valued only by .

We combine these gadgets to create the instance as follows. Starting from the left, construct the Clause-Gadget for each clause . Then, construct the Variable-Gadget for each variable . Thus, we obtain an instance with agents and items.

###### Claim.

The following statements hold:

• Any contiguous allocation in where every agent gets at least two items they value yields a satisfying assignment for . This holds even if the allocation is partial, i.e., some items are not allocated.

• Any satisfying assignment for yields a contiguous envy-free allocation in where every agent gets exactly two items they value.

###### Proof of Claim.

Consider any (possibly partial) contiguous allocation in where every agents gets at least two valued items. All of the items valued by or lie in the Variable-Gadget for . Let denote the second item in this gadget. Note that this item must necessarily be allocated to or (and it cannot remain unallocated, even in a partial allocation). If obtains , then we set . If obtains , we set . We now claim that is a satisfying assignment for . Consider any clause and the three associated agents . At most two of those agents can obtain their two items from the Clause-Gadget for . Thus, there exists such that is allocated a valued item outside the Clause-Gadget. But the only other place where values items is inside the Variable-Gadget for the variable of (the literal in clause corresponding to agent ). Since obtains an item in this gadget, one can check that the agent corresponding to the literal must obtain the second item in the gadget. It follows that the literal has value in the assignment , and thus the clause is satisfied by .

Conversely, let be any satisfying assignment for . For every clause , there exists an agent such that the literal is true in . Allocate the four items in the Clause-Gadget for to the other two clause agents (two contiguous items for each). Then, has only two valued items remaining, namely the ones in the Variable-Gadget corresponding to . Allocate them to . Once this is done for all clauses, we move on to the Variable-Gadget agents. Assume that ; the case where can be treated analogously. Then, the first two items of the Variable-Gadget for are allocated to , while obtains the only two remaining items that it values (which are not adjacent). However, no clause agent has been allocated any item in this interval, because items there are only valued by with and those agents have been allocated items within their respective Clause-Gadget (because ); therefore we may allocate all items in this interval to . At this point, some items in the Variable-Gadget might still be unallocated, namely items that lie in the interval starting from the third item up to the last item not allocated to . If all of these items are unallocated, then allocate them all to . Note that the items allocated to are indeed contiguous. If some of these items are already allocated, then they are allocated to clause agents. Simply extend the intervals allocated to these clause agents until they form a partition of this region. This construction ensures that every agent obtains exactly two items they value. Moreover, for every other agent , obtains at most two items valued by . ∎

The final step of the proof is to introduce one last gadget. The Special-Gadget creates new agents. We denote the set of these new agents by . The gadget consists of new items. These items are valued by all agents in . For every and , values all new items except the rightmost six. For every , and value all new items except the rightmost four.

The Special-Gadget is added to the right end of and yields the final instance . Note that in there are agents and every agent values exactly items. Now consider any contiguous allocation for .

• If the allocation is proportional, then every agent gets at least items they value. It follows that the agents in get all the new items, because . This means that the other agents get at least two items they value in . By the claim above, we obtain a satisfying assignment.

• If the allocation is equitable, then all agents get exactly items they value, for some . The Special-Gadget contains an item (in fact, many) that is valued by all agents. Since this item will be allocated to someone, is not possible. Also is not possible, because the agents in all like the exact same items. Now, since all agents value the first items in the Special-Gadget, at least one of them will be allocated to two of those (by the pigeonhole principle). It follows that is also impossible. Thus, only remains, and we again obtain a satisfying assignment by the claim.

Since envy-freeness implies proportionality, it follows that any -allocation for yields a satisfying assignment for the 3-SAT instance , for any non-empty . On the other hand, any satisfying assignment for the 3-SAT instance yields an envy-free and equitable allocation for , by assigning two contiguous Special-Gadget items to each agent in and then using the claim. ∎

In the construction used for our proof of Theorem 5.1, each agent values at most four contiguous block of items. In light of this result, one may naturally wonder whether the hardness continues to hold if, for example, every agent values a single block of items. We show that this is the case for proportionality, provided that we drop the requirement that all agents value the same number of items. Note that if each agent values a contiguous block of items and all agents value the same number of items, deciding whether a proportional allocation exists can in fact be done in polynomial time. Indeed, we can view the problem as a scheduling problem on a single machine, with each agent having a task to be completed by a machine. For a given task, its release time is where the corresponding agent’s valued block starts, its deadline is where the block ends, and its length is the number of items that we need to give the agent in order to satisfy proportionality. When all tasks have the same length, which is true in our setting, polynomial-time algorithms have been proposed by Simons (1978) and Garey et al. (1981).

###### Theorem 5.2.

Deciding whether an instance with indivisible items on a line admits a contiguous proportional allocation is NP-hard, even if the valuations are binary and every agent values a contiguous block of items.

###### Proof.

We reduce from the 3-partition problem. An instance of the 3-partition problem consists of positive integers with sum , and the goal is to partition them into sets of size three each so that the three numbers in each set sum to . The problem is NP-hard, and remains so when for all (Garey and Johnson, 1979).

Given an instance of 3-partition, we create an instance of our problem as follows. There are items on the line, where . Each item belongs to one of the three types: special, normal, and dummy. From left to right, the last items are dummy items. The remaining items are partitioned into blocks of size —the leftmost item of each block is a special item (so special items in total), and the remaining items of the block are normal items (so normal items in total). There are agents: special, normal, and dummy. Each of the special agents values a distinct special item and nothing else. Each dummy agent values all dummy items and nothing else. For , the th normal agent values the leftmost items. Note that this is well-defined because . Moreover, , so each normal agent values all normal items (along with other items).

First, suppose that there is a valid solution to the 3-partition instance. We construct a proportional allocation. Give each special agent her valued item, and each dummy agent consecutive dummy items. For each part in the solution to the 3-partition instance, we pick a block of normal items and give consecutive items to the th normal agent. One can check that the resulting allocation is proportional; in particular, each dummy agent needs at least valued items, and that is exactly what they get.

Conversely, suppose that our construction admits a proportional allocation. In this allocation, each special agent must get her valued item and, as above, each dummy agent needs at least valued items. Since there are dummy agents and they value the same items, each dummy agent must receive exactly valued items. This leaves only the normal items to be allocated to the normal agents. Normal agent needs to get at least items, so given that , all normal items must be allocated to the normal agents, and normal agent must receive exactly items. Finally, since for all , each block of normal items is allocated to exactly three agents. Hence the allocation yields a valid solution to the 3-partition instance, as desired. ∎

Next, we show that under the same conditions as Theorem 5.2, deciding whether there exists a proportional and equitable allocation, or an equitable allocation that gives the agents positive value, are both computationally hard. Since agents do not all value the same number of items (unlike in Theorem 5.1), we normalize the valuations so that if agent values items, she has value of each of them (so her total value is ).

###### Theorem 5.3.

Deciding whether an instance with indivisible items on a line admits

• a contiguous allocation that is both proportional and equitable;

• a contiguous equitable allocation in which the agents receive positive value

are both NP-hard, even if the valuations are binary and every agent values a contiguous block of items.

###### Proof.

The reduction is similar to the one in Theorem 5.2. We again reduce from 3-partition, but this time we also assume that for all . Note that we can ensure that this is the case by multiplying all and by .

Let . The main building block of this reduction is a -block: consecutive items with agents who only value these items. The instance is constructed as follows. Starting from the left end of the line, there are consecutive -blocks. Note that each -block has its own agents. We call this the “left region” of the instance. The “right region” of the instance consists of blocks of items each. The leftmost items of such a block form a -block, and there are items to the right of that -block. Finally, we introduce new agents . For each , agent values the rightmost items on the line. Note that this is well-defined, since there are items overall. Furthermore, agent values all items in the right region, because (since and ). Note that every agent values a contiguous block of items.

Now consider any equitable allocation in which the agents receive positive value. Every agent must get at least one item that they value. Consider any -block. Since its agents only value these items, it follows that they each obtain exactly one. Thus, they each get value exactly , and all other agents in the instance must also get value exactly . This means that agent must obtain exactly of its valued items. Since for all , each block of items in the right region are allocated to exactly three agents . Hence, we obtain a solution to the 3-partition instance. Note that a proportional and equitable allocation yields positive value to the agents, so it also gives rise to a solution to the 3-partition instance.

Conversely, given a solution to the 3-partition instance, one can construct an equitable allocation in which the agents receive positive value by following the previous paragraph. Note that this allocation is also proportional, since each agent receives value and there are more than agents. This completes the proof. ∎

## 6 Conclusion

In this paper, we study the classical cake cutting problem with the contiguity constraint and establish several hardness results and approximation algorithms for this setting. It is worth noting that while our -envy-free algorithm (Algorithm 1) is simple, lowering the envy to for the restricted class of uniform single-interval valuations (Algorithm 2) already requires significantly more work. Pushing the approximation factor down further even for this class or the class of piecewise uniform valuations while maintaining computational efficiency is therefore a challenging direction. Of course, it is possible that there are hardness results for sufficiently small constants—this is not implied by the work of Deng, Qi, and Saberi (2012), as their PPAD-completeness result relies on more complex valuation functions.

On the hardness front, we provide constructions that serve as frameworks for deriving NP-hardness results for both cake cutting and indivisible items. Nevertheless, our frameworks do not cover questions related to the utilities of the agents, for instance whether there exists a contiguous envy-free allocation of the cake in which the first agent receives at least a certain level of utility. Extending or modifying our constructions to deal with such questions is an interesting direction for future research.

## Acknowledgments

This work was partially supported by the European Research Council (ERC) under grant number 639945 (ACCORD) and by an EPSRC doctoral studentship (Reference 1892947). We would like to thank the anonymous reviewers for their helpful comments.

## References

• Alijani et al. (2017) Alijani, R.; Farhadi, M.; Ghodsi, M.; Seddighin, M.; and Tajik, A. S. 2017. Envy-free mechanisms with minimum number of cuts. In

Proceedings of the 31st AAAI Conference on Artificial Intelligence (AAAI)

, 312–318.
• Arunachaleswaran et al. (2019) Arunachaleswaran, E. R.; Barman, S.; Kumar, R.; and Rathi, N. 2019. Fair and efficient cake division with connected pieces. In Proceedings of the 15th Conference on Web and Internet Economics (WINE), Forthcoming.
• Aumann and Dombb (2015) Aumann, Y., and Dombb, Y. 2015. The efficiency of fair division with connected pieces. ACM Transactions on Economics and Computation 3(4):23.
• Aumann, Dombb, and Hassidim (2013) Aumann, Y.; Dombb, Y.; and Hassidim, A. 2013. Computing socially-efficient cake divisions. In Proceedings of the 12th International Conference on Autonomous Agents and Multiagent Systems (AAMAS), 343–350.
• Barrera et al. (2015) Barrera, R.; Nyman, K.; Ruiz, A.; Su, F. E.; and Zhang, Y. 2015. Discrete envy-free division of necklaces and maps. CoRR abs/1510.02132.
• Bei and Suksompong (2019) Bei, X., and Suksompong, W. 2019. Dividing a graphical cake. CoRR abs/1910.14129.
• Bei et al. (2012) Bei, X.; Chen, N.; Hua, X.; Tao, B.; and Yang, E. 2012. Optimal proportional cake cutting with connected pieces. In Proceedings of the 26th AAAI Conference on Artificial Intelligence (AAAI), 1263–1269.
• Bei et al. (2019) Bei, X.; Igarashi, A.; Lu, X.; and Suksompong, W. 2019. Connected fair allocation of indivisible goods. CoRR abs/1908.05433.
• Bilò et al. (2019) Bilò, V.; Caragiannis, I.; Flammini, M.; Igarashi, A.; Monaco, G.; Peters, D.; Vinci, C.; and Zwicker, W. S. 2019. Almost envy-free allocations with connected bundles. In Proceedings of the 10th Innovations in Theoretical Computer Science Conference (ITCS), 14:1–14:21.
• Bouveret et al. (2017) Bouveret, S.; Cechlárová, K.; Elkind, E.; Igarashi, A.; and Peters, D. 2017. Fair division of a graph. In Proceedings of the 26th International Joint Conference on Artificial Intelligence (IJCAI), 135–141.
• Brams and Taylor (1996) Brams, S. J., and Taylor, A. D. 1996. Fair Division: From Cake-Cutting to Dispute Resolution. Cambridge University Press.
• Brânzei and Nisan (2017) Brânzei, S., and Nisan, N. 2017. The query complexity of cake cutting. CoRR abs/1705.02946.
• Brânzei and Nisan (2019) Brânzei, S., and Nisan, N. 2019. Communication complexity of cake cutting. In Proceedings of the 20th ACM Conference on Economics and Computation (EC), 525.
• Caragiannis et al. (2016) Caragiannis, I.; Kurokawa, D.; Moulin, H.; Procaccia, A. D.; Shah, N.; and Wang, J. 2016. The unreasonable fairness of maximum Nash welfare. In Proceedings of the 17th ACM Conference on Economics and Computation (EC), 305–322.
• Cechlárová and Pillárová (2012) Cechlárová, K., and Pillárová, E. 2012. On the computability of equitable divisions. Discrete Optimization 9(4):249–257.
• Cechlárová, Doboš, and Pillárová (2013) Cechlárová, K.; Doboš, J.; and Pillárová, E. 2013. On the existence of equitable cake divisions. Information Sciences 228:239–245.
• Deng, Qi, and Saberi (2012) Deng, X.; Qi, Q.; and Saberi, A. 2012. Algorithmic solutions for envy-free cake cutting. Operations Research 60(6):1461–1476.
• Dubins and Spanier (1961) Dubins, L. E., and Spanier, E. H. 1961. How to cut a cake fairly. The American Mathematical Monthly 68(1):1–17.
• Garey and Johnson (1979) Garey, M. R., and Johnson, D. S. 1979. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman.
• Garey et al. (1981) Garey, M. R.; Johnson, D. S.; Simons, B. B.; and Tarjan, R. E. 1981. Scheduling unit-time tasks with arbitrary release times and deadlines. SIAM Journal of Computing 10(2):256–269.
• Igarashi and Peters (2019) Igarashi, A., and Peters, D. 2019. Pareto-optimal allocation of indivisible goods with connectivity constraints. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence (AAAI), 2045–2052.
• Lipton et al. (2004) Lipton, R. J.; Markakis, E.; Mossel, E.; and Saberi, A. 2004. On approximately fair allocations of indivisible goods. In Proceedings of the 5th ACM Conference on Electronic Commerce (EC), 125–131.
• Marenco and Tetzlaff (2014) Marenco, J., and Tetzlaff, T. 2014. Envy-free division of discrete cakes. Discrete Applied Mathematics 164:527–531.
• Procaccia (2016) Procaccia, A. D. 2016. Cake cutting algorithms. In Brandt, F.; Conitzer, V.; Endriss, U.; Lang, J.; and Procaccia, A. D., eds., Handbook of Computational Social Choice. Cambridge University Press. chapter 13, 311–329.
• Robertson and Webb (1998) Robertson, J., and Webb, W. 1998. Cake-Cutting Algorithms: Be Fair if You Can. Peters/CRC Press.
• Segal-Halevi, Hassidim, and Aumann (2016) Segal-Halevi, E.; Hassidim, A.; and Aumann, Y. 2016. Waste makes haste: bounded time algorithms for envy-free cake cutting with free disposal. ACM Transactions on Algorithms 13(1):12:1–12:32.
• Simons (1978) Simons, B. 1978. A fast algorithm for single processor scheduling. In Proceedings of the 19th Annual Symposium on Foundations of Computer Science (FOCS), 246–252.
• Stromquist (1980) Stromquist, W. 1980. How to cut a cake fairly. The American Mathematical Monthly 87(8):640–644.
• Stromquist (2008) Stromquist, W. 2008. Envy-free cake divisions cannot be found by finite protocols. The Electronic Journal of Combinatorics 15:#R11.
• Su (1999) Su, F. E. 1999. Rental harmony: Sperner’s lemma in fair division. The American Mathematical Monthly 106(10):930–942.
• Suksompong (2019) Suksompong, W. 2019. Fairly allocating contiguous blocks of indivisible items. Discrete Applied Mathematics 260:227–236.

## Appendix A Proof of Theorem 4.1

We provide a full proof of NP-hardness for the following decision problems:

1. Does there exist an envy-free allocation in which agent gets the leftmost piece?

2. Does there exist an envy-free allocation in which agents get the leftmost pieces, in that order? (for any constant )

3. Does there exist an envy-free allocation in which all the agents are assigned pieces in that order from left to right?

4. Does there exist an envy-free allocation such that there is a cut at position ? ( given in the input)

5. Does there exist an envy-free allocation such that the leftmost cut is at position ? ( given in the input)

6. Does there exist an envy-free allocation such that there are cuts at positions , , ? (, , given in the input, any constant)

The problems remain NP-hard if we replace envy-freeness by -envy-freeness for any .

###### Remark.

The list of NP-hard problems that we have provided is by no means exhaustive. The construction we provide below should be viewed as a framework for obtaining these kinds of results. Indeed, with some simple modifications, one can prove additional results of the same general flavor. In particular, one can change the constraint to “agent gets the th piece from the left ( constant)” or to “the leftmost cuts are at positions , , ”.

Let be an instance of -sat with clauses , where each clause is made out of literals using the variables and their negations. Note that is polynomial in and thus we can use as the complexity parameter for the instance. Let be arbitrary.

We will construct an instance where the cake is the interval (for some polynomial ), instead of the usual . This is just for convenience as it is easy to obtain a completely equivalent instance on in polynomial time. Indeed, it suffices to divide the position of every block by and multiply its height by . Note that our construction also gives NP-hardness if the valuations are given in unary representation, since the positions and heights of blocks will have numerator and denominator bounded by some polynomial (even after we scale down to ). All the valuations we construct will be piecewise uniform, and in fact all blocks of all agents will have height (before scaling the cake to ), but variable length. Furthermore, value-blocks of different agents will not overlap.

Clause-Gadget. Consider any clause in the instance . will be represented by a Clause-Gadget in the cake cutting instance. The Clause-Gadget for requires an interval of length on the cake, say , where only three specific agents are allowed to have any value. These agents are denoted by , and . The interpretation is that corresponds to the first literal appearing in the clause , to the second one, and to the third one. The valuation of agent contains three blocks of value in the interval : one in each of the subintervals , and . Each of these blocks has value (i.e., length and height ). Agents and have the same blocks as , but shifted by and to the right respectively. The valuations of the three agents inside the Clause-Gadget are shown in Figure 1.

Note that each of the three agents has value inside the Clause-Gadget. The remaining value will be situated in a different gadget that we introduce next.

Variable-Gadget. For every variable we introduce a Variable-Gadget in the cake cutting instance. The Variable-Gadget for requires an interval of length , say , and introduces two new agents and . has a block of value in the subinterval , and has a block of value in the subinterval . For every clause that contains (respectively ) in the th position (), the agent has a block of value lying at the center of the subinterval (respectively ). See the illustration in Figure 2.

Instance. Now consider the cake-cutting instance constructed as follows: starting from the left, position all the Clause-Gadgets one after the other, leaving an interval of length after every gadget. Then, position all the Variable-Gadgets one after the other, again leaving an interval of length after every gadget. Thus, the cake is the interval , where the first Clause-Gadget occupies the interval , and the first Variable-Gadget occupies the interval . There are agents so far. Note that adjacent gadgets are separated by intervals of length that we call Isolating Intervals. There are exactly Isolating Intervals.

The th Isolating Interval from the left is denoted . The Isolating Interval is divided into three subintervals: , and . Furthermore, we also add an interval of length 3 on the left end of the cake: the Initiation Interval. We denote it by and it is similarly subdivided into , and . The cake is now represented by the interval .

We add two new agents and . Agent has a block of value in , a block of value in each of , and . Agent has a block of value in . For we define an agent that has a block of value in and a block of value in each of and . We also define an agent that has a block of value in . Figure 4 shows the valuations of the agents in , and . The total number of agents is , so there are cuts in any solution.

Let . Since an envy-free allocation always exists, the cake-cutting instance we have constructed admits an envy-free allocation (in particular also -envy-free). In order to ensure that a solution only exists if the 3-sat formula is satisfiable, we have to add an additional constraint. An -envy-free allocation is said to satisfy the Isolation property if together all the Clause- and Variable-Gadgets contain at most cuts strictly within them.

###### Lemma A.1.

Any -envy-free allocation that satisfies the Isolation property yields a satisfying assignment for the 3-sat formula.

###### Proof.

Consider any -envy-free allocation. If there is at most one cut strictly inside the Clause-Gadget of , then there is an agent () who does not obtain any of its value from this Clause-Gadget. Thus, agent gets value at most (from its corresponding Variable-Gadget). However, since the Clause-Gadget of is divided into at most two parts, some agent gets at least according to agent ’s valuation, which contradicts -envy-freeness. Thus, every Clause-Gadget contains at least two cuts strictly within them.

If the Variable-Gadget for does not strictly contain any cut, then all of it is allocated to a single agent. Necessarily, agent or would have envy . Thus, every Variable-Gadget strictly contains at least one cut.

Now consider an -envy-free allocation that also satisfies the Isolation property. Since the property permits at most cuts strictly inside gadgets, we get that these lower bounds on the number of cuts inside gadgets are actually tight. Thus, there are exactly two cuts strictly inside every Clause-Gadget and exactly one cut strictly inside every Variable-Gadget.

Since there is exactly one cut strictly inside the Variable-Gadget of , the two resulting parts must go to agents and . Indeed, if one of these two agents does not get one of the two parts, then the agent would have envy at least . Similarly, since there are exactly two cuts strictly inside the Clause-Gadget of , the three resulting parts must go to agents , and . Indeed, if one of these three agents does not get one of the three parts, the agent would have value (as she cannot get any value from the corresponding variable gadget) and therefore have envy at least .

We now show how such a solution yields a satisfying assignment to the 3-sat instance. Consider the Clause-Gadget of . As we showed above, there are exactly two cuts strictly inside the gadget and the three resulting parts go to the agents , and . Any of these three agents who obtains at most of its own value is called sad. By inspection of the construction of the Clause-Gadget it follows that at least one of the three agents must be sad. Indeed, it is easy to check that if is not sad, then at least one of the other two must be. The fact that any Clause-Gadget must have at least one sad agent will be used to encode the fact that any clause of the 3-sat instance must have at least one literal set to . Thus, if is sad, this means that we set the literal corresponding to to have the value .

It remains to check that this is consistent, i.e., that we never set the two literals and to both be . In other words, we have to check that if some agent corresponding to the literal is sad, then all agents corresponding to are not sad. If agent is sad, then it gets value at most . Agent has a block of value in the Variable-Gadget of . This block must contain a cut, otherwise would have envy at least . But since there is a single cut inside the Variable-Gadget, the blocks of all agents corresponding to are not cut. As a result, these agents cannot be sad. ∎

###### Claim 1.

In any -envy-free allocation for this instance, every agent obtains a nonzero value.

###### Proof.

Assume on the contrary that some agent obtains value . Note that (like all agents) has a block of value at least somewhere on the cake such that no other agent has any value there. Since the allocation is -envy-free, it follows that this block must be cut into slices of value at most . Let be an agent that is assigned one of the slices strictly contained in this block. Agent also obtains value , and it must also have a block of value at least somewhere on the cake such that no other agent has any value there. This block must also be cut in slices of value at most , and since there are at least two slices that lie strictly inside the block, there exists such a slice that is not assigned to agent , but rather to some agent . We continue this procedure, always ensuring that we pick some agent that is not (which is always possible). Since the number of agents is finite, there exist such that . If , then one can check that we necessarily have . Thus, there exists such that . However, this is impossible due to our choice of , a contradiction. ∎

#### Fixing the ordering of agents.

###### Claim.

If there exists an -envy-free allocation in which agent gets the leftmost piece, then the 3-sat formula is satisfiable.

###### Proof.

In any -envy-free allocation in which agent gets the leftmost piece, the piece allocated to will be a strict prefix of . Indeed, if were allocated all of , then agent would have envy . It follows that agent will obtain value at most . As a result, the three blocks of value of must each contain at least one cut. Also, note that the Initiation Interval contains at least two cuts.

We now know that the two blocks of value of in and must each contain a cut. We show that agent must be allocated some interval in . Suppose for the sake of contradiction that this is not the case. Then, some agent must be allocated an interval in , since there are at least two cuts inside . But this agent cannot be or , so it will obtain value . However, by Claim 1, this is impossible.

Thus, must be allocated some interval in . It follows that obtains value at most . This, in turn, implies that the two blocks of value of in must each contain a cut. This means that we can repeat the argument above to show that must be allocated an interval in . By induction it follows that every Isolating Interval contains at least cuts. Thus, we have shown that at least cuts do not lie inside any Clause- or Variable-Gadget. This means that at most cuts lie strictly inside a Clause- or Variable-Gadget, and so the Isolation property holds. By Lemma A.1, any -envy-free allocation in which gets the left-most piece will yield a satisfying assignment to the 3-sat instance. ∎

We define the standard ordering of allocation as follows. Starting from the left, the first piece goes to agent and the second piece to . The rest of the agents are ordered according to the order of appearance of their gadget in the instance. For