Manuscript Offprint
arXiv:2611.26602An Efficient Algorithm for Matroid Cups
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We design a polynomial-time algorithm for matroid cups with discrepancy. Our matroid cups algorithm design consists of a sequence of reductions to simpler instances, culminating in instances of matroid cups where the matroid has rank 1.
Keywords: Matroids; Periodic Scheduling; Algorithms.
1 Introduction
We consider a setting consisting of a set system and a vector of probabilities. The ground set is a collection of operations/actions that one wants to perform periodically, and for each action the coordinate of , , represents the desired frequency for action . A subset of is independent in , that is in , if and only if all the actions in can be performed simultaneously. A schedule then specifies for each positive integer time a subset of with the property that . The height of at time , , is , where is the latest time prior (or equal to) that action was taken. The discrepancy of at time is the absolute value of the difference of the number of times the action has been performed by time and . In the “bamboo” problem the objective is to minimize the maximum height, that is minimize:
In the “cups” problem the objective is to minimize the maximum discrepancy, that is minimize:
We investigate whether there is an efficient algorithm, that given an independence oracle for , will iteratively output the components of an infinite schedule , where by efficient we mean that the time used by the algorithm to output each component is bounded by a polynomial in the cardinality of the ground set and the number of bits used to present the probability vector . Before stating the results of our investigation, we give some background from the literature.
For all set systems, there exist schedules with maximum height , and there are set systems where this is best possible [4, 6]. The lower bound for general set systems motivates the consideration of set systems that are matroids. For every matroid , there exists a schedule with optimal discrepancy 1 [6], but it was not know how to compute an -height or -discrepancy for a general matroid in polynomial-time; In this setting a polynomial-time algorithm is one where for all times the amount of time the algorithm runs between producing and is polynomial in , the cardinality of the ground set.
However polynomial-time algorithms are known for special classes of matroids. Most importantly there exists a polynomial-time algorithm for rank 1 matroids that achieves optimal discrepancy 1 (and hence optimal height 2) [11]. We will conceptualize this algorithm, which we will refer to as the Unit Clock Algorithm, as a circular clock, with one hand for each . All the hands initially have the same initial orientation. Then at each integer time, each hand advances clockwise radians, and the clock outputs the that will soonest reach the original orientation, among those that have not been output since they last passed the original orientation. Further there are efficient algorithms that achieve discrepancy for uniform matroids [3], height 2 for uniform and partition matroids [6], and height 4 for laminar and graphic matroids [6].
These are the most relevant results for our purposes, but this just scratches the surface on research in this area originating from the discrete math and combinatorial optimization communities. Good jumping points for further background are the recent papers [6, 5]. Additionally there is a whole research community, the real-time scheduling community, devoted to studying periodic scheduling. A reasonable jumping off point for research from this community is the textbook [2].
1.2 Our Contribution to the Story
We first note that the existential result from [6] can relatively easily be made constructive to yield an efficient algorithm for matroid bamboo for that achieves essentially optimal height for all matroids.
Theorem 1.
For all fixed there is a polynomial-time algorithm for matroid bamboo that achieves height at most .
The proof of Theorem 1 appears in Appendix B. This algorithm for matroid bamboo does not necessarily yield schedules with discrepancy. So our main contribution is an efficient algorithm for matroid cups for that achieves discrepancy for all matroids.
Theorem 2.
There is a polynomial-time algorithm for matroid cups that achieves discrepancy at most .
In the next section we give an overview of the design and analysis of the algorithm from Theorem 2, and the organization of the rest of the paper.
2 Technical Overview
Our algorithm design for matroid cups consists of a sequence of reductions to simpler instances of matroid cups, culminating in instances of matroid cups where the matroid has rank 1, thus solvable by the Unit Clock algorithm. To aid the reader in seeing the main ideas, we brush some details under the rug in this section.
Our first reduction reduces an instance of matroid cups for the original general matroid to an instance of matroid cups for a that is the contraction of a transversal matroid that can be represented by a polynomially-sized bipartite graph. To accomplish this reduction, our algorithm creates its schedule in blocks of consecutive units of time. The schedule for block is computed at the start of time +1, and will be executed from time to . The services during will consist of a multiset of elements of the ground set of , where is the rank of . The multiset will be the union of two multisets, the required services that will appear in every , and the fill . The required services can be represented by a vector where is the number of required services for each . The actual schedule is then produced from by a matroid intersection algorithm in a standard manner. This reduces the matroid cups problem for the original matroid to the problem of producing the sequence of fills. But the problem of producing the sequence of fills is just an instance of the cups problem for the set system , where a subset is independent (that is ) if can be feasibly scheduled in time units, and where the probability associated with each element is . A key insight is that if then is equal to a matroid , which is the contraction on of a transversal matroid on ground set . Further, this transversal matroid is represented by a polynomial-size bipartite graph , where the resource side has cardinality . We give further detail in Section 3.
Our next reduction step is to reduce the matroid cups problem for matroid to the matroid cups problem for an even simpler matroid , which is a contraction of the transversal matroid represented by the forest , derived from by replacing the edge set with an arbitrary acyclic fractional matching in that covers each element of to extent 1, each element of to extent 1, and each to extent . The matroid is also a series-parallel graphic matroid represented by a polynomial-size series-parallel forest . The forest can be obtained from by rooting each tree in at an arbitrary element of , making nodes in parallel nodes, and nodes in series nodes. The leaves of will be made to be the ground set . Thus the matroid is a reduction of the matroid in that every set that is independent in is also independent in , and each fill returned by our algorithm will be a base of .
We then observe that there is a simple randomized process that generates a basis of matroid that matches the target marginal probabilities in exactly, that is for all the probability that is . In this process each internal node receives a bit from its parent (other than the root which always receives a 1 bit) and passes along bits to its children using a fixed probability distribution. For a parallel node with child define , to be the probability that passes a received 1 bit to , and for a sequential node with child , define to be the probability that passes a received 0 bit to . The basis is then the leaves that receive a 1 bit. We give further detail about the reduction to the series-parallel matroid and the process in Section 4.
Thus our goal becomes designing a deterministic procedure , that produces an infinite sequence of bases of that will constitute the fills, and that maintains small discrepancy relative the process. To accomplish this, we partition the internal nodes in into parts, that we call chunks. In our algorithm for generating the next fill, each chunk will receive a bit from its parent chunk, and will pass along a bit to each child chunk. See Figure 1(a). Note the problem of matching the process internal to a chunk is just an instance of matroid cups where the ground set is essentially the edges leaving the chunk. We have two goals for when forming the chunks:
- The chunks are sufficiently simple that we can design an efficient low-discrepancy algorithm for these chunk instances of matroid cups.
- The chunks significantly dissipate/distribute the discrepancy received from above.
To better understand this second goal consider a parallel node , with two children and . Assume that in the process, the node sees a stream of all 1 bits from its parent, and in response to each bit passes the to with probability and to with probability (and passes the other child a 0 bit). Suppose the discrepancy introduced above by our algorithm above on the incoming stream at is . So sees 0 bits. If and , then the discrepancy of the bits arriving at would be , plus any additional discrepancy introduced by our algorithm at . In contrast, if and , then discrepancy of the bits arriving at both and would be , plus any additional discrepancy introduced by our algorithm at . Thus we want to form the chunks so that the effect of discrepancy introduced higher in by our algorithm will decrease geometrically as the bits flow toward the leaves.
To accomplish these two chunk formation goals, each chunk will be ancestor-to-descendant paths, where each is the favorite child of , and , where the favorite child is the one with maximum probability. We give more detail of how the algorithm chunks , and uses the chunks to create the fill, in Section 5.
After forming the chunks, we are left with the problem of designing an efficient chunk algorithm, which is just an algorithm for instances of matroid cups that arise in the chunks. Consider a chunk which is an ancestor-to-descendant path in . Let the children of nodes in (that are not in ) be . Thus our chunk algorithm determines the nodes in that receive a 1 bit in response to the node receiving a bit , which we will call a parity bit. For each the algorithm maintains a default subset/base of . Further for each the algorithm maintains a unit clock on the vertices in . In this context “unit clock” means a black box solution to a particular instance of matroid cups with a matroid of rank 1 with discrepancy 1. These two clocks are called the chunk clocks. Further for each , and for each vertex , the algorithm maintains a unit clock for , which we call a vertex clock. When the parity bit arrives, the parity chunk clock is called, producing an element (or possibly no element). Then the parity vertex clock for vertex is called, producing another element . If then the vertices in receiving a 1 bit are those in , and otherwise it will be the case that , and then the vertices in receiving a 1 bit are those in . So for each parity bit , the elements of receiving a 1 bit are within one swap of a default base . Note that time only advances for a clock when it is called. See Figure 1(b) for an illustration of our chunk algorithm. We give more detail about the design of the chunk algorithm in Section 6.
(a) A chunk tree, in which the chunks are the rectangles, showing a computation that would output .
(b) parity half of a chunk algorithm. The default basis is .
Figure 1: Overview of our algorithm for producing the fill.
Finally in Section 7 we prove that our algorithm has discrepancy. At a high level this follows from the fact that the chunk algorithm has discrepancy for the matroid cups instances that arise internally to a chunk, and the fact that the effect of the discrepancy introduced within a chunk decreases geometrically as the bits flow down the chunk tree.
To close our overview let us recall Segal’s law [7]:
“A man with one watch knows what time it is. A man with two watches is never sure.”
In fact this quote is misattributed to Segal, and the originator of the quote remains unknown [7]. So this allows us to irresponsibly conjecture that this quote originated from some early researcher perplexed by the puzzle of matroid cups. In the implausible circumstance that this conjecture is correct, one can view our algorithm as overcoming the challenges expressed in Segal’s law, by deriving a good time for each action from the state of many clocks. Our top priority was to explain how to achieve discrepancy in polynomial time as cleanly as possible; in particular, we did not prioritize obtaining the best possible constants.
3 Reduction To A Contraction of a Transversal Matroid
We now want to understand the subsets of the ground set that can feasibly be chosen as the fill. We start with the characterization used in [6], and then introduce some definitions in preparation for giving our alternative characterization.
Lemma 1.
[6, 8] A subset can be feasibly scheduled with the services in in time units if and only if , where is the indicator vector for , and is the independence polytope for matroid inflated by a factor of .
Definition 1.
Let for bases of , where and for all . Assume without loss of generality that for . For convenience, let .
Definition 2 (Fill Set System).
Let be a positive integer. The fill set system is the set system where is in if and only if .
Definition 3.
We define as the bipartite graph where
- The left-hand side consists of vertices for each element .
- The right-hand side consists of vertices for each element .
- For each element the left-hand side vertices that are derived from are connected by an edge to the right-hand side vertices derived from .
- For each element the left-hand side vertices that are derived from are connected by an edge to each right-hand side vertex derived from an element for which is independent in the original matroid .
Definition 4.
Define the set system to be the one where is in if and only if there exists a matching in that matches every element in .
Lemma 2.
is a matroid.
Proof.
represents a transversal matroid with ground set , and results from contracting this transversal matroid on . Thus is a matroid as matroids are closed under contraction. ∎
Lemma 3.
For all , every independent set of is an independent set of .
Proof.
Let be arbitrary. By the definition of there exists a matching in that matches every element in . We then want to show is independent in . By the definition of , we need to show that . A point if and only if for all subsets it is the case that , where is the rank function for [8]. Thus is sufficient to show that for all it is the case that
So consider an arbitrary such . Let be the collection of all the elements in that are derived from some element in union with all elements in . Let be the neighborhood of on the right-hand side of . At a high level, the insight behind the proof is that if the neighborhood of in is small, then the matching in guarantees that the matroid constraint for holds, and if the neighborhood of in is large, then there must be some slack in the matroid constraint for , and thus making large enough handles rounding the for up to 1.
We now break the proof into cases. In the first case assume that all vertices in are derived some some vertex in . Then establish the condition in (1) as follows:
The first equality follows from the definition of , the first inequality follows since matches all vertices in , the second equality follows from the definition of and the assumption of this case, and the final inequality arrives because is an independent set in .
Otherwise, for the second case assume contains a vertex that is not derived from some . Thus by the definition of it must be the case that there exists a such that . Thus , so
We now want to use the fact that is not full rank in to upper bound the aggregate rates for as follows:
The first inequality follows from Definition 1, the first inequality follows from equation (2), the second equality follows by algebra, and second inequality follows from the assumption that is the largest coefficient . We now establish the condition in (1) as follows:
The first inequality follows from the fact that by definition and , the second inequality follows the inequality in line (3), and the last inequality follows from the assumption that . ∎
As an aside, it is relatively easy to show that the converse of Lemma 3 holds for all , that is is a reduction of and thus , by a straightforward application of Hall’s condition to . We show this later in Claim 1. From here on we fix and drop it from the matroid notation. So for example will henceforth mean .
4 The Reduction to a Series-Parallel Matroid and the Process
We first explain how the algorithm constructs the series-parallel forest , and then define the randomized process . Our starting point for the construction of is a suitable acyclic fractional matching in .
Lemma 4.
has an acyclic fractional matching that covers each element of to extent 1, each element of to extent 1, and each to extent .
Proof.
First, we show has a fractional matching meeting the stated covering constraints. Next, we cancel cycles in while maintaining the covering constraints, producing acyclic fractional matching .
Let . Note that , where the subset direction is clear, and the superset direction follows by the integrality of the polytope on the right hand side. Similarly, let . Note that , where we mean that there exists a fractional matching in that matches every vertex in to extent , every vertex in to extent , and every vertex to extent . Again, the equality follows because the subset direction is clear, and the superset direction follows by the integrality of the polytope on the right hand side.
Claim 1.
Every independent set of is an independent set of .
Proof.
Let be arbitrary. Then . We want to show , i.e. there exists a matching in that matches every element in . At a high level, the matroid rank constraints will supply Hall’s condition, which will imply that the matching exists.
Let be arbitrary and be the neighborhood of in . Let be the subset of elements where contains a left-side vertex derived from , and let be the subset of elements where contains a right-hand side vertex derived from . . We know , because for each we have , so [8, Corollary 39.12a]. Thus
Thus for all , so by Hall’s theorem, there exists a matching in that matches every element in . Thus . ∎
Via Claim 1, every independent set of is an independent set of . Thus . Because , we have . Thus . Thus is matchable in , so there exists a fractional matching in that matches every vertex in to extent , every vertex in to extent , and every vertex to extent .
Next, while contains a cycle in its positive support, partition the edges of into two matchings by alternating edges, and continuously increase the values on one matching while decreasing the values on the other matching at the same rate, until some edge in has value . Note that the amount that covers each vertex does not change during this procedure. Thus upon termination, we will have an acyclic fractional matching meeting the stated covering constraints. ∎
The algorithm then constructs a series-parallel forest from in the following manner:
The construction of the series-parallel forest from the fractional matching :
First all isolated edges are removed from . Then for each that is not a leaf in , give this vertex a new label , and create a new node with parent . Let be the set of all such created in this step. Then root each tree in the resulting forest at an arbitrary vertex in . The nodes in are parallel nodes and the nodes in are series nodes. We then convert into a full binary tree in the standard way, by repeatedly applying an arbitrary one of the following three transformations:
- If there is a node with parent and a single child , then remove and make a child of .
- If there is a parallel node with children for then create a new parallel node , make and children of , and make children of .
- If there is a series node with children for then create a new series node , make and children of , make and children of .
Lemma 5.
The leaves of are exactly the ground set of the matroid .
Proof.
We first show that the leaves of are exactly after isolated edges are removed and is constructed, and then we show that each of the three transformations maintains the leaves of .
First, observe that the leaves of , which are in or , are in isolated edges of . If is a leaf in , then its sole incident edge matches to extent , and thus matches to extent , so is also a leaf in . Conversely, if is a leaf in , then its sole incident edge matches to extent , and thus matches to extent , so is also a leaf in . Consequently, there are no leaves in or after isolated edges are removed. It is also clear by construction that there are no leaves in .
We now show that after isolated edges are removed and is constructed, all of the elements are leaves. If is a leaf in , then we know that the other endpoint on the unique edge cannot be a leaf in , so is not an isolated edge. Thus remains a leaf in . Further, if is not a leaf in , then it is automatically made a leaf because of its replacement with .
Lastly, it is easy to check that each of the three transformations changes the children of nodes in , but not whether a node has children (i.e. whether a node is a leaf). Thus the leaves of the full binary forest are exactly . ∎
We now inductively extend the probabilities on the leaves of to the internal nodes.
Definition 5.
For each internal node , with children and , we define to be if is a parallel node, and to be if is a series node.
Lemma 6.
For all nodes it is the case that .
Proof.
Let be the forest computed before repeatedly performing the three transformations. First, we show that the claim holds on the forest , under a general rule for constructing the values, and then we show that each of the three transformations preserve the values.
For an edge between vertex and its parent in , let be the value on edge in the acyclic fractional matching , where we set for a vertex and its corresponding vertex . For a vertex , let if is a leaf in . Otherwise, has children , and recursively define if is a parallel node (equivalently ), and if is a series node (equivalently ). We show by induction from the leaves upward that
First, if and is a nonroot vertex, then
The first equality follows by the parallel recurrence. The second equality follows by the inductive hypothesis for all . The third equality follows by for all , because is the sole edge in which is matching , so must match to extent . The fourth equality follows because is matched to extent .
Second, if and is a root vertex, then the same reasoning gives .
Third, if , then
The first equality follows by the series recurrence. The second equality follows by the inductive hypothesis for all . The third equality follows by simplification. The fourth equality follows because is matched to extent . Lastly, if , then let be the unique child of in , giving
The first equality follows by the series recurrence. The second equality follows by the inductive hypothesis for all . The third equality follows by simplification. The fourth equality follows because is matched to extent .
Thus because for each edge between vertex and its parent in , and because for all leaves , we have for all .
Next, we show that when is altered under the three transformations, the values are still preserved under the general series and parallel recurrence rules, and new vertices which are created satisfy . Because the general rules are the same as the binary tree rules for , this will complete the proof.
First, if a node has a single child , then regardless of whether is a parallel node or a series node. Thus replacing with does not change the value of the parent of . Second, if a node is a parallel node with children for , then we replace ’s children with where is parallel and has children . Thus we have
as before, and further so . Lastly, if a node is a series node with children for , then we replace ’s children with where is series and has children . Thus we have
as before, and further so . Thus for all , completing the proof. ∎
Definition 6.
For each internal node , with children and , we define for each child of as follows:
- If is a parallel node and then .
- If is a parallel node and then .
- If is a series node and then .
- If is a series node and then .
We define a randomized process on each tree in the forest that we will show generates a basis of matroid , and that matches the marginal probabilities for each leaf .
The Process:
In this process each internal node receives a bit from its parent (other than the roots which always receive a 1 bit) and passes along bits to its children in the following manner:
- If is a parallel node and receives a 0 bit from its parent then passes a 0 bit to each child.
- If is a parallel node and receives a 1 bit from its parent then passes a 1 bit to each child of with probability , and passes a 0 bit to the other child.
- If is a series node and receives a 1 bit from its parent then passes a 1 bit to each child.
- If is a series node and receives a 0 bit from its parent then passes a 0 bit to each child of with probability , and passes a 1 bit to the other child.
Lemma 7.
The process is well-defined, and each vertex receives bit with probability .
Proof.
First, the transition probabilities are well-defined. At a parallel node with children and s.t. , we have
and at a series node with children and s.t. , we have
We now induct down the tree. Each root receives bit with probability , as shown in the proof of Lemma 6. Suppose a vertex receives bit with probability , and let be a child of .
If is a parallel node and , then
If is a parallel node and , then . Further, by induction always receives bit , so always receives bit . Thus .
If is a series node and , then
so . If is a series node and , then . Further, by induction always receives bit , so always receives bit . Thus .
Thus the process is well-defined, and every vertex receives bit with probability . ∎
Definition 7.
In the set system a set is in if and only if the probability that are exactly the leaves that receive 1 bits in the process is positive.
Lemma 8.
Every independent set of is an independent set of .
Proof.
Let be arbitrary, and fix some realization of the process where is exactly the set of leaves which receive bit . Let and . For each , if received bit then match to its parent, and else received bit , so match to its unique child which also received (a unique child exists because is a parallel node). Then modify the matching by taking each matched to some and instead matching to the corresponding . Lastly, for each , match to its unique neighbor in using the isolated edge . Let be the resulting matching. We now show that is a matching in that matches every element in , proving that .
Let be arbitrary. If , then is matched to its unique neighbor in using the isolated edge . Otherwise . If received bit , then it passes bit to some child , and then are matched. Otherwise received bit , so it received bit from its parent , and then are matched. Thus is matched.
Let be arbitrary. Then received bit . If the parent of is some , then received bit , and are matched. Otherwise the parent of is the corresponding . If received bit , then passes to exactly one child , and are originally matched, so are matched in the end. Otherwise received bit , so the parent received bit , and are originally matched, so are matched in the end. Thus is matched.
Let be arbitrary. Then received bit . If the parent of is some , then if received bit then is matched to its parent, and if received bit then it is matched to its unique child which also received bit . Thus is not matched. Otherwise the parent of is the corresponding , which also received bit . But then passed bit to all of its other children , which will each match to their children who also received bit , and for the same reasoning as before, is not matched to its parent because it received bit . Thus is not originally matched, so is not matched.
Thus matches exactly in , so . ∎
5 Chunking the Series-Parallel Forest
In this section, we explain how our algorithm recursively constructs the chunks from that will form the chunk tree.
Definition 8.
For each internal node , with children and , we define the favorite child of to be if , and to be otherwise.
Chunk Forming Algorithm:
Let be a parameter that we will set later to be . Let be a root of . If the favorite child of is a leaf, or has , then let the chunk . Otherwise, let be the ancestor to descendant path in where each is the favorite of its parent , and
- , and
- is a leaf or .
Then the path becomes a chunk, and the process continues recursively on each tree in the forest (other than trees that consist of a single leaf).
Definition 9.
Let be a chunk of the forest , and be the children of the nodes in where is the child of not in for all , is the favorite child of , and is the other child of . For each :
- Define to be the probability that node receives a 1 bit in the process on conditioned on the fact that received a 0 bit in the process.
- Define to be the probability that node receives a 1 bit in the process on conditioned on the fact that received a 1 bit in the process.
Lemma 9.
Consider the setting from Definition 9. Let for some . Then and is the unique solution to the two equations
where if , if , and if .
Proof.
First, we show that . This is because is the probability that receives bit and is the probability that receives bit in the process (Lemma 7), so we can compute by conditioning on whether receives bit or bit , and multiplying by the probabilities of these events and , respectively.
Next, we show that . Define as the probability that receives bit given that receives bit in the process for . Define
We now show by induction that and for all , and that . First, note , , and , so we have . Next, assume for some . If is a parallel node, then receives bit if and only if receives bit and passes bit to . Thus and , so . Similarly, if is a series node, then receives bit if and only if receives bit and passes bit to . Thus and , so . The same reasoning for gives . This completes the induction, and it remains to show the equation holds for and . The same reasoning gives and , completing the proof. ∎
We are now ready to describe our algorithm for producing the sequence of fills. This algorithm uses two subroutines for each chunk , a 0 parity chunk algorithm, and a 1 parity chunk algorithm. Each subroutine when called will output a bit for each child of a node in .
The Fill Algorithm :
Initially, for each root of , the 1 parity chunk algorithm is called for the chunk containing the root, which outputs a bit for each child of a node in . The algorithm then iteratively considers chunks whose root has received a bit, but no parity chunk algorithm has been called yet for . If received a 0 bit then the 0 parity chunk algorithm for is called, else ( received a 1 bit) the 1 parity chunk algorithm for is called. In each case the parity chunk algorithm outputs a bit for each child of a node in . This process terminates when a parity chunk algorithm has been called for each chunk. The next fill is then exactly the leaves that received a 1 bit.
6 The Chunk Algorithm
The goal of this section is to describe the parity chunk algorithm for a particular parity and a chunk . Each time each algorithm is called, it will compute a subset of the collection of children of , send bits to the children in this subset, and send bits to the children not in this subset. Here the parent of , , is , and is the favorite child of . The parity chunk algorithm maintains a default base , and each computed subset will be of the form .
The parity chunk algorithm maintains a unit clock for the chunk , which we call the chunk clock, and a unit clock for each vertex , which we call the vertex clocks. Each clock will only advance when called by the parity chunk algorithm. First, the unit clock for the chunk is called, which will return a selected element of . If the selected element is in , then it will become , and otherwise it will become . If the selected element then the unit clock for will be called to select . If the selected element then the unit clock for will be called to select . So it remains to describe how the parity chunk algorithms initially compute the default bases, and set up the unit clocks.
6.1 The Default Bases
The default bases are conceptually formed by pushing the parity bit down the chunk, ending with the favorite child of . This results in the following default bases:
- Let be the elements of , ordered by increasing depth, whose parents in are series nodes, followed by if is a parallel node.
- Let denote the elements of , ordered by increasing depth, whose parents in are parallel nodes, excluding if is a parallel node.
- Let be the elements of , ordered by increasing depth, whose parents in are series nodes, excluding if is a series node.
- Let denote the elements of , ordered by increasing depth, whose parents in are parallel nodes, followed by if is a series node.
Before setting up the unit clocks, we need to prove some facts about the relationship between various probabilities that nodes receive a 1 bit during the process. For ease of notation, we write to mean and to mean .
Lemma 10.
For it is the case that .
Proof.
This follows because the number of elements in receiving a 1 bit in the process is exactly plus the number of series nodes in , regardless of the random events internal to . This quantity is exactly . Thus , so . ∎
Lemma 11.
For it is the case that .
Proof.
First, consider . An element receives a bit if and only if its parent receives bit , and passes bit to , because is a parallel node. Thus if , and if . Thus
The first inequality follows by the stated upper bounds on . The second inequality follows by for all , and because is the favorite child of , so . The third inequality follows by . The fourth inequality follows by the choice .
Next, consider . An element receives a bit if and only if its parent receives bit , and passes bit to , because is a series node. Thus if , and if . Thus
The first inequality follows by Lemma 10. The second inequality follows by the stated upper bounds on . The third inequality follows by the same reasoning as before. ∎
Lemma 10 follows immediately from the fact that the number of 1 bits passed to a node in depends only on the parity bit . This will allow us to conceptually perfectly match elements in the default base with elements not in the default base. Lemma 11 show that the aggregate probability that sends a 1 to elements in that are not in the default base is at most 1. This is what enables the algorithm to always output 1 bits to a subset of that is within one swap of the appropriate parity default base.
6.2 Setting Up the Chunk Clocks
The construction of the clocks is not conceptually difficult, but the notation required for a formal definition is somewhat painful. The reader is encouraged to refer frequently to the example shown in Figure 2. Once one understands the example in this figure, both the algorithm design and analysis should be clear. We first need some definitions. Let . Let , and . To reduce notational complexity a bit, we are now going to drop the reference to in the variables.
The algorithm first computes intervals as follows:
- .
- is maximum (but at most ) so that intersects only one interval of the form or only intersects one interval of the form .
The parity chunk clock then contains hands, with associated probabilities:
If the chunk clock outputs the ’st hand, which is not associated with an interval, then the algorithm outputs . Otherwise, the chunk clock outputs the ’th hand corresponding to interval for some , and the vertex clock for is called.
Figure 2: An example instance for constructing the chunk and vertex clocks. See Figure 1(b) for a illustration of the resulting clocks.
6.3 Setting Up the Vertex Clocks
The algorithm maintains a vertex clock for each interval of the form for . First consider the case that interval intersects only one interval of the form . We will call the dominant vertex for interval . Let
be the intervals of this form that intersect . Then the algorithm initializes a vertex clock for the interval with possible outcomes , which we call subordinate vertices. The probability of outcome is the fraction of the interval covered by the interval , that is
If the vertex clock outputs , then the algorithm outputs .
Now consider the case that intersects only one interval of the form . We will call the dominant vertex for interval . Let
be the intervals of this form that intersect . Then the algorithm initializes a vertex clock for the interval with possible outcomes , which we call the subordinate vertices. The probability of outcome is the fraction of the interval covered by the interval , that is
If the vertex clock outputs , then the algorithm outputs .
6.4 Correctness
The fact that the construction of the chunk clocks and vertex clocks are well-defined follows from Lemma 10 and Lemma 11. It remains to show that if the chunk algorithm outputs or , then this output can be implemented into a feasible execution of the process.
Lemma 12.
For it is the case that for the output of the parity chunk algorithm, where or , there exists a feasible execution of the process where the nodes receive bits and the nodes receives bits.
Proof.
First, consider . The nodes could receive bits and the nodes could receive bits if the bit is passed down the entire chunk by definition of . Now consider the nodes output by the chunk algorithm. We claim that appears higher in the tree than , i.e. and for . If the claim holds, then the nodes could receive bits and the nodes could receive bits in the following execution of the process: the bit is passed down the chunk, flipping at the parent of (sending a bit to , and a bit to its sibling), passing the bit down the chunk, flipping back at the parent of (sending a bit to , and a bit to its sibling), and passing the bit down the rest of the chunk.
Claim 2.
If the parity chunk algorithm outputs , then appears higher in the tree than .
Proof.
We first show that if for some and , then is above in the tree. If , then the claim trivially holds. Otherwise, note that in every execution of the process on the chunk with input bit , the nodes which receive bit and the nodes which receive bit alternate going down the chunk, starting with a node . Thus for any prefix of the chunk with children , the expected number of children in receiving bit is at least the expected number of children in receiving bit . Formally, let be the last child in and be the last child in ; then we have . Now consider the prefix of the chunk where . If is below in the tree, then . Thus if , is above in the tree.
Next, we establish the claim. It suffices to show that . If is the dominant vertex in its interval , then the interval starts at , so we have . If is the dominant vertex in its interval , then the interval ends at , so we have . ∎
Next, consider . The nodes could receive bits and the nodes could receive bits if the bit is passed down the entire chunk by definition of . Now consider the nodes output by the chunk algorithm. We claim that appears higher in the tree than , i.e. and for . If the claim holds, then the nodes could receive bits and the nodes could receive bits in the following execution of the process: the bit is passed down the chunk, flipping at the parent of (sending a bit to , and a bit to its sibling), passing the bit down the chunk, flipping back at the parent of (sending a bit to , and a bit to its sibling), and passing the bit down the rest of the chunk.
The claim follows by a symmetric argument from before. ∎
7 Discrepancy Analysis
In this section, we upper bound the discrepancy of our matroid cups algorithm.
Lemma 13.
[11, 1] The Unit Clock algorithm has discrepancy at most .
Lemma 14.
Let be the discrepancy of the Unit Clock algorithm. Let . Let be a chunk and . Then the stream of bits that the parity chunk algorithm sends to , with respect to target probability of bits, has discrepancy at most .
Proof.
We suppress from the notation. First, suppose for some . Consider an interval which has positive intersection with . Let be the number of times the chunk clock selects in its first calls, and let
be the signed discrepancy for interval with respect to target probability . If is subordinate in , then let be the number of times the vertex clock selects in its first calls, and let
be the signed discrepancy for in the vertex clock , with respect to target probability .
If is dominant in , then after calls to the chunk algorithm, this interval contributes bits to . If is subordinate in , then after calls to the chunk algorithm, this interval contributes bits to . Note that
So the net target probability is , and summing over all intervals which have positive intersection with , the net target probability for is , as desired. Let be the total number of times that receives a bit in the first calls to the chunk algorithm, and let .
By maximality of the constructed intervals, an element occurs in at most two consecutive intervals, and if it occurs in two, it is subordinate in the first. Indeed, if an element’s interval extends beyond the first interval that it intersects, then the interval will extend to at least the right endpoint . Further, if the element was dominant in , then that interval already could have extended to the right endpoint .
This gives four cases, where in each case we use the fact that and , because these are the discrepancies of Unit Clock algorithms.
- is subordinate in one interval . Then so .
- is dominant in one interval . Then so .
- is subordinate in and dominant in . Then so .
- is subordinate in both and . Then so .
The argument for is symmetric, where we count the number of removals from with target probability . The “inclusion” signed discrepancy is the negative of the “removal” signed discrepancy, so its absolute discrepancy is also at most . ∎
Lemma 15.
Let be the discrepancy of the parity chunk algorithm. Let be a leaf in the series-parallel forest . Then the Fill algorithm has discrepancy at most with respect to target probability .
Proof.
Let count the number of times vertex receives bit in the first steps of the Fill algorithm, and write
where is its target frequency of receiving bit .
Consider a chunk with root , and an element , where consists of the children of vertices of that lie outside . For , let count the number of times receives bit in the first calls to the parity chunk algorithm for . Define
where is the target frequency of sending bit to when receives bit . By assumption,
After steps, the parity chunk algorithm for has been called times, and the -parity chunk algorithm for has been called times. Hence
Since
by Lemma 9, subtracting gives
Consequently,
First consider the case that is the root of some chunk in . Via Lemma 9, if , then we have . If is a child of the last vertex of the chunk , then . Otherwise, . Thus because . We now show inductively down the chunk tree that every chunk root satisfies
At a root of , every incoming bit is and , so . For a chunk root which is not a root of , the induction hypothesis gives
Finally, let be a leaf of , and let be the root of the chunk containing its parent. Using , we obtain
is the discrepancy of the Fill algorithm because the algorithm includes precisely when it receives bit , completing the proof. ∎
Lemma 16.
Let be the discrepancy of the Fill algorithm. Then overall algorithm has discrepancy at most .
Proof.
Let be the block length, and recall that and . Let be the fill selected for block , so that this block schedules element exactly
times. Define the fill signed discrepancy
whose absolute value is at most .
Write an arbitrary time as , where , and let count services of in the first steps of block . The internal-block guarantee from [6] gives
Let count the total services of by time , and let . Since , we have
Thus the overall signed discrepancy is a convex combination of the fill signed discrepancies at two consecutive block boundaries, plus the internal-block error. Consequently,
for all elements and times , completing the proof. ∎
Lemma 17.
The overall algorithm has discrepancy at most .
Proof.
The Unit Clock algorithm has discrepancy at most (Lemma 13). Thus the parity chunk algorithm has discrepancy at most (Lemma 14). Thus for , the Fill algorithm has discrepancy at most (Lemma 15). Thus the overall algorithm has discrepancy at most (Lemma 16). ∎
Acknowledgments: The result arose from extensive interactions between the authors and GPT-6 Astra. The exposition is primarily the product of the authors. Claude was used to aid the writing of the section on the analysis of discrepancy. Claude was also used to produce the figures, create bibtex entries, and create LaTeX code for some of the standard definitions in the appendix. The authors accept full responsibility for the correctness of the result. We made a reasonable attempt to track the source of the ideas, and have included citations as appropriate.
References
O. Angel, A. E. Holroyd, J. B. Martin, and J. Propp (2009) Discrete low-discrepancy sequences. Note: Revised July 2010ArXiv External Links: 0910.1077, Link Cited by: Lemma 13.
S. Baruah, M. Bertogna, and G. Buttazzo (2015) Multiprocessor scheduling for real-time systems. Embedded Systems, Springer International Publishing, Cham, Switzerland. External Links: ISBN 978-3-319-08695-8, Document Cited by: §1.1.
M. A. Bender, M. Farach-Colton, and W. Kuszmaul (2019) Achieving optimal backlog in multi-processor cup games. In Symposium on Theory of Computing (STOC), M. Charikar and E. Cohen (Eds.), Phoenix, AZ, USA, pp. 1148–1157. Cited by: §1.1.
S. Cicerone, G. D. Stefano, L. Gasieniec, T. Jurdzinski, A. Navarra, T. Radzik, and G. Stachowiak (2019) Fair hitting sequence problem: scheduling activities with varied frequency requirements. In International Conference on Algorithms and Complexity (CIAC), pp. 174–186. Cited by: §1.1.
J. Kuszmaul (2022) Bamboo trimming revisited: simple algorithms can do well too. In Symposium on Parallelism in Algorithms and Architectures (SPAA), pp. 411–417. Cited by: §1.1.
M. Mendoza-Cadena, A. Merino, M. A. Nielsen, and K. Schewior (2026) Combinatorial perpetual scheduling: existence and computation of low-height schedules. In International Colloquium on Automata, Languages, and Programming, (ICALP), S. Bhattacharya, D. Nanongkai, M. Benedikt, and G. Puppis (Eds.), LIPIcs, Vol. 374, pp. 142:1–142:23. Cited by: Appendix B, §1.1, §1.1, §1.1, §1.1, §1.2, §3, §7, Lemma 1.
Quote Investigator (2022) Quote origin: a person with one watch knows what time it is. a person with two watches is never sure. Note: https://quoteinvestigator.com/2022/07/04/watch/Accessed November 4, 2026 Cited by: §2, §2.
A. Schrijver (2003) Combinatorial optimization: polyhedra and efficiency. Algorithms and Combinatorics, Vol. 24, Springer. Cited by: Appendix A, §3, §4, Lemma 1.
D. E. Speyer (2008) Tropical linear spaces. SIAM Journal on Discrete Mathematics 22 (4), pp. 1527–1558. External Links: Document Cited by: footnote 1.
D. Speyer and L. K. Williams (2021) The positive Dressian equals the positive tropical Grassmannian. Transactions of the American Mathematical Society, Series B 8, pp. 330–353. External Links: Document Cited by: footnote 1.
R. Tijdeman (1980) The chairman assignment problem. Discrete Mathematics 32 (3), pp. 323–330. Cited by: §1.1, Lemma 13.
Wikipedia contributors (2026) Series–parallel graph — Wikipedia, the free encyclopedia. Note: https://en.wikipedia.org/w/index.php?title=Series%E2%80%93parallel_graph&oldid=1358933008[Online; accessed 8-November-2026] Cited by: footnote 2.
Appendix A Standard Matroid Theory Background [8]
Definition 10 (Matroid).
A matroid is a pair , where is a finite set (the ground set) and is a family of subsets of (the independent sets) satisfying:
(I1) . (I2) (Hereditary property) If and , then . (I3) (Exchange property) If and , then there exists such that .
Definition 11 (Matroid intersection).
Let and be two matroids on the same ground set , with rank functions and . The intersection of and is the set system
whose members are the common independent sets: those that are independent in both and . In general is not a matroid.
The matroid intersection problem asks for a common independent set of maximum cardinality, and this problem can be solved in polynomial time given efficient independence oracles for .
Definition 12 (Matroid independence polytope).
Let be a matroid. The matroid independence polytope is
where is the indicator vector of . It is known that , where and is the rank function of the matroid.
Theorem 3.
For matroids on common ground set , the polytope is integral, that is,
Appendix B Proof of Theorem 1
Proof of Theorem 1.
Without loss of generality, assume that for all , because the elements with can simply be removed from and never scheduled. Let . We first define modified rates , that round up to the next rate that is an integer multiple of , where is some parameter which we will specify later. Let if , and otherwise, for all . Then let and . Note that lies inside the independence polytope of , because for all ,
Our algorithm then produces the schedule in blocks of size time units using the reduction to matroid intersection from [6]. This algorithm guarantees that occurrence of element is in the time range for all . Thus
where is the height with respect to growth rates . Note that for all , if an algorithm guarantees maximum height at most for growth vector then the algorithm guarantees height at most for the growth vector . Because , this algorithm guarantees maximum height at most for growth vector . Selecting gives that the algorithm guarantees maximum height at most and runs in time polynomial in , and the input encoding length of , so the algorithm runs in time polynomial in and . ∎