Also available at http://amc.imfm.si ISSN 1855-3966 (printed edn.), ISSN 1855-3974 (electronic edn.) ARS MATHEMATICA CONTEMPORANEA 4 (2011) 95–109 The total weak discrepancy of a partially ordered set Alan Shuchat ∗ a, Randy Shull b, Ann N. Trenk a a Department of Mathematics, Wellesley College, Wellesley, MA 02481, USA b Department of Computer Science, Wellesley College, Wellesley, MA 02481, USA Received 13 June 2010, accepted 13 October 2010, published online 15 March 2011 Abstract We define the total weak discrepancy of a poset P as the minimum nonnegative integer k for which there exists a function f : V → Z satisfying (i) if a ≺ b then f(a) + 1 ≤ f(b) and (ii) ∑ |f(a)− f(b)| ≤ k, where the sum is taken over all unordered pairs {a, b} of incomparable elements. If we allow k and f to take real values, we call the minimum k the fractional total weak discrepancy of P . These concepts are related to the notions of weak and fractional weak discrepancy, where (ii) must hold not for the sum but for each individual pair of incomparable elements of P . We prove that, unlike the latter, the total weak and fractional total weak discrepancy of P are always the same, and we give a polynomial-time algorithm to find their common value. We use linear programming duality and complementary slackness to obtain this result. Keywords: Posets, weak discrepancy, fractional weak discrepancy, total linear discrepancy. Math. Subj. Class.: 06A06, 06A07, 90B10 Dedication The third author was fortunate to have Mike Albertson as her instructor when she was a high school student at the Hampshire College Summer Studies in Mathematics program. In the years since he continued to be a mentor and friend. All three of us have benefited from his part in organizing the CoNE conferences, his example as a prominent researcher at a liberal arts college, and his many other contributions to discrete mathematics. ∗Corresponding author. E-mail addresses: ashuchat@wellesley.edu (Alan Shuchat), rshull@wellesley.edu (Randy Shull), atrenk@wellesley.edu (Ann N. Trenk) Copyright c© 2011 DMFA Slovenije 96 Ars Math. Contemp. 4 (2011) 95–109 1 Introduction In this paper we will consider irreflexive posets P = (V,≺), and write x ‖ y when elements x and y in V are incomparable. We begin with some background on weak and fractional weak discrepancy. 1.1 Background and examples A poset P = (V,≺) is a weak order if there exists a real-valued function f : V → R so that x ≺ y if and only if f(x) < f(y). We can think of such a function as assigning a rank to each element of P in such a way that respects the ordering ≺ and gives incomparable elements equal rank. Sometimes it is desirable to rank the elements of a poset that is not a weak order. For example, a poset could represent a set V of employees partially ordered by their value to a company and the function value f(v) could represent employee v’s salary. We want such a ranking function to satisfy two “fairness” conditions: first that a more valuable employee receives a significantly higher salary, and second that we seek to minimize the largest discrepancy in salaries between incomparable employees. Additional motivating examples can be found in [12]. These fairness conditions are made more formal in the following definition. Definition 1.1. The fractional weak discrepancy of a poset P = (V,≺), denoted by wdF (P ), is the minimum nonnegative real number k for which there exists a function f : V → R satisfying (i) if a ≺ b then f(a) + 1 ≤ f(b) (“up” constraints) (ii) if a ‖ b then |f(a)− f(b)| ≤ k. (“side” constraints) For this and similar definitions, we will call a function f that achieves the minimum value of k an optimal labeling of P . Fractional weak discrepancy was first defined in [8] and studied further in [7, 9, 10, 11]. The integer version of the problem, where each function value f(v) must be an integer, was introduced in [13] as the weakness of a poset, and studied further as weak discrepancy in [4, 12]. Definition 1.2. The weak discrepancy of a poset P = (V,≺), denoted by wd(P ), is the minimum nonnegative integer k for which there exists a function f : V → Z satisfying conditions (i) and (ii) of Definition 1.1. In [8], the authors used linear programming duality to prove that wdF (P ) is always rational and that the weak discrepancy of a poset is always its fractional weak discrepancy rounded up to the next integer, wd(P ) = dwdF (P )e. Moreover, taking the ceilings (or floors) of an optimal labeling for the fractional problem gives an optimal labeling for the integer problem. The linear programming approach shows that weak and fractional weak discrepancy can be computed in polynomial time. For example, the poset Z shown in Figure 1 with optimal labelings has wdF (Z) = 4/3 and wd(Z) = 2. Optimality follows from results in [8]. Returning to the salary example, we can take a different approach to evaluating the fairness of the ranking function f by minimizing the average, or equivalently, the total discrepancy in salaries f(v) between incomparable employees v rather than the largest dis- crepancy. Definitions 1.3 and 1.4 formalize this notion in its fractional and integer versions. A. Shuchat, R. Shull and A. N. Trenk: The total weak discrepancy of a partially ordered set 97 2/3 5/3 a1 a2 0 1 2 a3 a4 a5 1/3 4/3 a6 a7 1 2 a1 a2 0 1 2 a3 a4 a5 1 2 a6 a7 Figure 1: The poset Z with optimal fractional weak (left) and optimal weak (right) label- ings. Here wdF (Z) = 4/3 and wd(Z) = 2. Definition 1.3. The fractional total weak discrepancy of a poset P = (V,≺), denoted by twF (P ), is the minimum nonnegative real number k for which there exists a function f : V → R satisfying (i) if a ≺ b then f(a) + 1 ≤ f(b) (ii) ∑ |f(a)− f(b)| ≤ k, where the sum is taken over all unordered pairs {a, b} of incomparable elements a ‖ b. Definition 1.4. The total weak discrepancy of a poset P = (V,≺), denoted by tw(P ), is the minimum nonnegative integer k for which there exists a function f : V → Z satisfying conditions (i) and (ii) of Definition 1.3. Thus we have four variants of weak discrepancy, as shown in Table 1. Each of these variants represents a different problem, but we will prove in Theorem 3.1 that the two problems in the “sum” column of the table are essentially the same. labels minmaxa‖b |f(a)− f(b)| min ∑ a‖b |f(a)− f(b)| integers weak discrepancy total weak discrepancy wd(P ) tw(P ) reals fractional weak discr. fractional total weak discr. wdF (P ) twF (P ) Table 1: Four variants of weak discrepancy. An optimal labeling for fractional weak discrepancy need not be optimal for fractional total weak discrepancy. An example is given by the poset Z in Figure 1. The fractional labeling on the left is optimal for wdF (P ) and gives the value ∑ |f(a)− f(b)| = 28/3. But the integer labeling on the right gives ∑ |f(a)− f(b)| = 9, so twF (Z) ≤ tw(Z) ≤ 9. In fact, in Example 3.3 we conclude that twF (Z) = tw(Z) = 9. Also, an optimal labeling for weak discrepancy need not be optimal for total weak discrepancy. While the optimal labeling for wd(Z) is optimal for tw(Z), this is not the case for the poset Y in Figure 2. The labeling on the left is optimal for weak discrepancy but not for total weak discrepancy. In fact, there is no labeling of Y that is simultaneously 98 Ars Math. Contemp. 4 (2011) 95–109 • • • • • • a1 a2 a3 a4 a5 a6 0 1 2 0 0 1 • • • • • • a1 a2 a3 a4 a5 a6 0 1 2 0 0 0 Figure 2: The poset Y with optimal weak (left) and total weak (right) labelings. The labels are identical except for the point a6. Here wdF (Y ) = wd(Y ) = 1 and tw(Y ) = 3. The optimal labeling for weak discrepancy is not optimal for total weak discrepancy. optimal for the weak and total weak discrepancy problems. In Section 2, we use Y to illustrate our linear programming approach to finding total weak discrepancy. 1.2 Comparability invariants We discuss comparability invariance results for several forms of discrepancy. Recall that a property of a poset P is a comparability invariant if it is shared by all posets with the same comparability graph as P . The linear discrepancy of a poset, defined formally in [12], is equivalent to the weak discrepancy with the additional condition in Definition 1.2 that the labeling function be injective. Similarly, total linear discrepancy, studied in [2] and [5], is equivalent to total weak discrepancy with an injective labeling function. It was shown in [4] that weak discrepancy is a comparability invariant and in [12] that linear discrepancy is also a comparability invariant. Indeed, the linear discrepancy of a poset is equal to the bandwidth of its incomparability graph [3]. In contrast, the posets P and Q in Figure 3 show that total weak discrepancy is not a comparability invariant. The reader can check that P and Q have the same comparability graph but different values of tw. Indeed, the labelings shown are optimal for total weak discrepancy, with tw(P ) = 2 and tw(Q) = 3. Likewise, total linear discrepancy is not a comparability invariant. Using the results of [2] and [5], it is easy to check that the total linear discrepancy of P is 8, while that of Q is 7. In particular, because total weak discrepancy and total linear discrepancy are not com- parability invariants, there can be no result analogous to the bandwidth result for these types of discrepancy. 2 Fractional total weak discrepancy and linear programming For the remainder of this article we let P = (V,≺) be a poset with at least one incom- parable pair of elements. Let V = {a1, a2, . . . , an}. Choosing a labeling function f on V corresponds to choosing real numbers x1, x2, . . . , xn, where xi = f(ai). Thus we can express the fractional total weak discrepancy twF (P ) as the solution to the following op- timization problem T . The decision variables for T are x1, x2, . . . , xn and a real number k. A. Shuchat, R. Shull and A. N. Trenk: The total weak discrepancy of a partially ordered set 99 • • • • • 0 1 1 1 2 P • • • • • 0 0 1 1 2 Q Figure 3: Two posets with the same comparability graph but with different total weak discrepancies. Here tw(P ) = 2 but tw(Q) = 3. Problem T : min k subject to xi − xj ≤ −1 when ai ≺ aj∑ |xi − xj | ≤ k over all pairs {ai, aj} with ai ‖ aj (2.1) xi, k unrestricted in sign Any choice of the variables xi, k that satisfies the constraints must have k ≥ 0, but it will be convenient to leave the sign of k unrestricted when we convert T to a linear programming problem and take its dual. Also, if there is an optimal solution to T then there is one where each xi ≥ 0, since any translation of the xi without changing k also satisfies the constraints. For the remainder of this paper, we will use the poset Y in Figure 2 as a running example to illustrate our results and methods. We begin in Example 2.1, where we compare the labelings in Figure 2 and start to formulate the linear program for Y . We ignore “up” constraints that are implied by transitivity and will prove in Proposition 2.5 that this is permissible. Example 2.1. Let the elements of the poset Y be a1, . . . , a6 as shown in Figure 2. The constraints ai ≺ aj (ignoring those implied by transitivity) correspond to the (i, j) pairs (1, 2), (2, 3), (4, 2), (5, 2). The incomparabilities can be written as ai ‖ aj , i < j, corresponding to the (i, j) pairs (1, 4), (1, 5), (1, 6), (2, 6), (3, 6), (4, 5), (4, 6), (5, 6). The labeling on the left in Figure 2 satisfies the constraints in Definition 1.3 for k ≥ 4 while the labeling on the right satisfies them for k ≥ 3. Thus the labeling on the left cannot be optimal for total weak discrepancy, and twF (Y ) ≤ tw(Y ) ≤ 3. We will verify that twF (Y ) = tw(Y ) = 3 in Example 2.8.  We will show that the (fractional) total weak discrepancy problem T is equivalent to a linear programming problem, PT , which we will think of as the primal problem in a primal- dual pair. The decision variables for PT are x1, x2, . . . , xn together with real numbers kij , indexed by the unordered pairs of incomparable elements of V . The constraints show 100 Ars Math. Contemp. 4 (2011) 95–109 that each kij ≥ 0 in any feasible solution but it will be convenient to leave their signs unrestricted. Problem PT : min ∑ ai‖aj i 0 along an arc (a, b) ∈ U\U1 where a ≺ c ≺ b for some node c. Set the flow to zero on (a, b) and add h to the flows on (a, c) and (c, b), leaving all other flows unchanged. The new flows satisfy the constraints in (2.5) with a larger value of the objective function, so the original solution was not optimal. We can get a great deal of insight into the nature of optimal solutions to the primal and dual problems by using the complementary slackness principle of linear programming. Recall that an inequality constraint is binding if its slack/surplus is zero, i.e., the solution satisfies the constraint with equality. Complementary Slackness Principle (e.g., see [6]): Consider a pair of feasible solutions to a linear programming problem and its dual. Both solutions are optimal if and only if (i) whenever a primal variable is positive then the corresponding dual constraint is binding and (ii) whenever a dual variable is positive then the corresponding primal constraint is binding. For the pair of problems in (2.3), (2.5) this gives the following result. A. Shuchat, R. Shull and A. N. Trenk: The total weak discrepancy of a partially ordered set 103 Proposition 2.6. Let {x, k} be a feasible solution for PT and let {u, s} be a feasible solution for DT . These solutions are optimal if and only if the following two conditions hold. (a) Let ai ≺ aj and uij > 0. Then xj = xi + 1. (b) Let ai ‖ aj . If sij > 0, then xi ≥ xj . Proof. Each dual constraint is an equation, so the complementary slackness conditions are always satisfied for the primal variables in any pair of feasible solutions. Each dual variable uij corresponds to an ordered pair (i, j) with ai ≺ aj and to the primal constraint xi−xj ≤ −1. Each dual variable sij corresponds to (i, j) with ai ‖ aj and to xi − xj − kij ≤ 0. Thus the complementary slackness conditions for the two problems reduce to the con- ditions uij(xi − xj + 1) = 0, sij(xi − xj − kij) = 0. Since kij ≥ 0 in any feasible solution to the primal, the result follows from the Com- plementary Slackness Principle. So at optimality, if an up flow uij in the circulation (dual) problem is positive then the labels in the primal problem increase by exactly one, i.e., xj = xi + 1. If a side flow is positive then the labels are nonincreasing. It immediately follows that if the side flows in both directions between two nodes are positive then the node labels are equal. In particular, the following corollary holds. Corollary 2.7. At optimality, if sij , sji > 0 then xi = xj . Example 2.8. Figure 5 displays the poset Y with elements labeled as shown on the right in Figure 2, together with a feasible assignment of arc flows (only positive side arc flows are shown). In Example 2.1, we used the node labels to show that twF (Y ) ≤ tw(Y ) ≤ 3. By duality, the arc flows show that twF (Y ) ≥ 3, the sum of the up flows. This verifies that the label and flow assignments are optimal and that twF (Y ) = tw(Y ) = 3. Observe that these assignments have the properties of Proposition 2.6 and Corollary 2.7.  3 Fractional total weak discrepancy equals total weak discrepancy We can now prove that twF (P ) is always an integer and thus equals tw(P ). This is true even though there are optimal labelings, i.e., optimal solutions to PT , that are not integer labelings (adding any constant to an optimal labeling gives another optimal labeling). In general, the coefficient matrix ( A O B −H ) is not totally unimodular since it contains the sub- matrix ( 1 −1 −1 −1 ) . For instance, in Example 2.3 we can form this submatrix from the first column and first two rows of B and −H . We will proceed as follows. First, we will use linear programming to find an optimal solution to the dual problem DT . We will use this solution, which is a circulation, to assign integer node labels xi = f(ai) that are feasible for the primal PT and satisfy the complementary slackness conditions. It will then follow from Proposition 2.6 that this label assignment f is optimal. Theorem 3.1. The fractional total weak discrepancy twF (P ) of any poset P can always be achieved with integer labels. Thus twF (P ) is an integer and equals tw(P ). 104 Ars Math. Contemp. 4 (2011) 95–109 • • • • • • a1 a2 a3 a4 a5 a6 0 1 2 0 0 0 2 OO 1 OO 0 dd 0 ii 0.5 ++ 0.5 kk 1 gg 1 xx 1 ** 1 '' 1 ** 1 uu 0.5 UU 0.5  Figure 5: The poset Y with node labels and arc flows. Side flows are shown with dashes and only side arcs with positive flow are shown. Example 2.8 shows the labels and flows are optimal and that twF (Y ) = tw(Y ) = 3. Proof. We first show the dual problem DT has an optimal solution. It has a feasible solu- tion, since we can set all the up flows equal to 0 and all the side flows equal to 1/2. Each feasible solution is a circulation in the digraph ~GP = (V,E) formed from P = (V,≺) and can be decomposed into at most |E| cycle flows (e.g., see [1]). Since each side flow lies in [0, 1], the flow in each cycle is bounded by one and so the sum of the up flows is bounded by |E|2. Thus the dual problem is bounded and has an optimal solution {u, s}. As a result, the primal is also feasible (this can also be shown using a linear extension of P ). Without loss of generality, we can assume the poset P is inseparable, i.e., it is not the lexicographic sum of nonempty subsets. If it were separable, we could partition P into inseparable components [13] and apply the argument that follows to each component. We now present a polynomial-time algorithm for defining a labeling f of the elements of P that is optimal for the primal PT and has integer values. We choose a minimal element a1 ∈ V and set the interval I(a1) = [0, 0]. The algorithm begins by initializing the remaining ranges I(a) = [l(a), r(a)] into which the labels will fall, and then progressively narrows these ranges. After no more narrowing is possible, we will define the labels by f(a) = l(a) (or alternatively, by f(a) = r(a)), for all a ∈ V . In particular, if I(a) is a singleton at any stage, then f(a) will be this value. Our initialization implies f(a1) = 0, but by translating all the values we can set f(a1) arbitrarily. The algorithm is based on the k-weak leveling algorithm of [13], which runs in polynomial time. Recall that Propositions 2.5 and 2.6 and Corollary 2.7 tell us how any optimal values xi for the primal problem must relate to each other. We use these relations to initialize the ranges as follows, so as to guarantee that each xi ∈ I(ai). Figure 6 shows how to make the initial assignment for the poset Y that appears in Figures 2 and 5. • I(a1) = [0, 0]. • If a1 ≺ ai, using Propositions 2.5 and 2.6(a) we set A. Shuchat, R. Shull and A. N. Trenk: The total weak discrepancy of a partially ordered set 105 I(ai) = { [1, 1], if u1i > 0 [1,∞), if u1i = 0. (3.1) • If a1 ‖ ai, using Proposition 2.6(b) and Corollary 2.7 we set I(ai) =  (−∞, 0], if s1i = 1, si1 = 0 [0,∞), if s1i = 0, si1 = 1 [0, 0], if s1i, si1 > 0. (3.2) Let M be the (n− 1)× (n− 1) matrix with rows and columns indexed by the elements of V other than a1, and having ones down the diagonal and zeroes elsewhere. We denote the entries of M by Mab. We will use this matrix to keep track of which I(a) need to be narrowed. Since M is symmetric we could only consider entries above or below the main diagonal, but that would complicate the notation. We repeatedly apply the following steps to the ranges I(a) = [l(a), r(a)], again using Proposition 2.6 and Corollary 2.7 to maintain complementary slackness for the relations considered at each point. We only apply steps that narrow the ranges, and continue until no further narrowing is possible. Choose distinct elements a and b in V \a1 with Mab = 0. If one or more of the fol- lowing situations occurs when we consider these elements as ai, aj in some order, then we take the steps indicated. If a ‖ b and both side flows between them are positive, we apply (3.5) both as written and with ai, aj interchanged. Figure 7 illustrates the effect of several of these steps when we begin with the initial ranges shown in Figure 6. • If ai ≺ aj and l(aj) ≤ l(ai), then increase l(aj) to l(ai) + 1 r(ai) ≥ r(aj), then decrease r(ai) to r(aj)− 1. (3.3) • If ai ≺ aj , uij > 0 and l(ai) < l(aj)− 1, then increase l(ai) to l(aj)− 1 r(aj) > r(ai) + 1, then decrease r(aj) to r(ai) + 1. (3.4) • If ai ‖ aj , sij > 0, and l(ai) < l(aj), then increase l(ai) to l(aj) r(ai) < r(aj), then decrease r(aj) to r(ai). (3.5) Reasoning again that the conditions in Proposition 2.6 and Corollary 2.7 are necessary, we conclude that after a range I(a) is narrowed, it still must contain f(a) for any optimal labeling f for which f(a1) = 0. Since the primal PT is feasible, the ranges are nonempty (i.e., l(a) ≤ r(a) in all cases). Now set Mab = Mba = 1. If I(a) (respectively, I(b)) is bounded at the end of this step and was narrowed during it, set Mac = Mca = 0 (Mbc = Mcb = 0) for all c 6= a, b. Note 106 Ars Math. Contemp. 4 (2011) 95–109 that in these steps, we will never increase an endpoint to∞ or decrease it to −∞, and so at most one endpoint of each range can be ±∞. Now repeat the procedure if possible. Once all entries of M equal one, no further narrowing steps can be executed. We then set f(a) = l(a) for each a ∈ V . Since ones in M can only be changed back to zeroes for bounded intervals that have been narrowed, only a finite number of changes are possible and the algorithm must terminate. We will show below that the ranges are all bounded after the last step, so that f is well-defined. After every step, the endpoint of each range is either an integer or ±∞. The con- struction shows that once further narrowing is impossible, the complementary slackness conditions must hold for all up and side relations involving elements whose ranges are bounded. So it remains to prove that after the last step, the ranges are all bounded. Then since the conditions in Proposition 2.6 are sufficient, we can conclude the integer labeling f is optimal. Case (a). For a contradiction, suppose that some range I(ai) = (−∞, r(ai)] after the last step. Then −∞ must have been the left endpoint of this range initially, so a1 ‖ ai and s1i = 1, si1 = 0. Again using the decomposition of a circulation into cycle flows, we see there must be a directed cycle in ~GP that contains (a1, ai) and has positive flow 0 < h ≤ 1 along each of its arcs. Let the next arc in the cycle be (ai, aj), for some aj . This is either an up arc with uij ≥ h > 0 or a side arc with sij ≥ h > 0. Since no further narrowing is possible, conditions (3.4) and (3.5) show that l(aj) = −∞. Continuing around the cycle until we reach a1, we arrive at a contradiction since l(a1) = 0. Thus each range is bounded below. Case (b). For a contradiction, suppose some I(ai) = [l(ai),∞) after the last step. We partition V into sets L = {y ∈ V : r(y) < ∞} and R = {z ∈ V : r(z) = ∞}. These are nonempty, since a1 ∈ L, ai ∈ R. Now take arbitrary elements y ∈ L, z ∈ R. We will prove that y ≺ z and then use our assumption that P is inseparable to reach a contradiction. Suppose z ≺ y. Either r(y) was finite initially or became finite at some step when I(y) was narrowed. In either case, we would have applied (3.3) to (z, y) when r(y) was finite and thus made r(z) finite. So z 6≺ y. Now suppose y ‖ z. If the flow from y to z is positive, applying (3.5) with ai = y, aj = z when r(y) < ∞ would have made r(z) < ∞, so this cannot occur. Thus the flow from z to y equals one. We can reason similarly to Case (a) to conclude there is a directed cycle containing (z, y) with positive flow h along each of its arcs. Let the next arc in the cycle be (y, aj) for some aj . By (3.4) and (3.5), r(aj) < ∞ so aj ∈ L. Continuing around the cycle until we arrive at z, we contradict z ∈ R. Thus y ≺ z for all y ∈ L and z ∈ R. But this is impossible since P is inseparable. So each range is bounded above. So after the last step of the algorithm, each range is a bounded interval. We choose the label f(a) to be either the left or right endpoint of the range, making the same choice for each a. The resulting labeling consists of integers and is feasible for the primal PT . By complementary slackness, the labeling is optimal. The reasoning in [13] shows the algorithm runs in O(|V |4) time. Example 3.2. Figure 6 shows the initial ranges that the algorithm prescribes for the node labels of the poset Y in Examples 2.1 and 2.8, based on the solution given for the dual in A. Shuchat, R. Shull and A. N. Trenk: The total weak discrepancy of a partially ordered set 107 • • • • • • a1 a2 a3 a4 a5 a6 [0, 0] [1, 1] [1,∞) [0, 0] [0,∞) [0,∞) 2 OO 1 OO 0 dd 0 ii 0.5 ++ 0.5 kk 1 gg 1 xx 1 ** 1 '' 1 ** 1 uu 0.5 UU 0.5  Figure 6: The poset Y with initial ranges for node labels set by choosing a1 as a minimal element and applying (3.1), (3.2) to the optimal arc flows of Figure 5. Figure 5. Figure 7 shows the ranges after applying the algorithm to the pairs {a2, ai}, i = 3, . . . , 6. For example, we apply (3.3) to change I(a3) from [1,∞) to [2,∞) and then apply (3.4) to change it again to [2, 2]. Similarly, we apply (3.3) to narrow I(a5) to [0, 0] and apply (3.5) to narrow I(a6) to [0, 1]. At a later stage, we consider {a5, a6} and narrow I(a6) further to [0, 0]. The optimal labeling this produces is the one on the right side of Figure 2.  Example 3.3. In Example 3.2 the ranges all reduce to singletons, but this is not always the case. We do not show the steps for the poset Z of Figure 1, but some of the ranges reduce to intervals with positive length. In particular, I(a3) = [−1, 0], I(a4) = [0, 1], and I(a5) = [1, 2]. Choosing f(a) = r(a) in all cases produces the integer labeling on the right side of Figure 1. So this labeling is optimal for both weak and total weak discrepancy, and tw(Z) = 9. We could also have reached this conclusion by finding a feasible assignment of flows for which the sum of the up flows equals 9.  4 Open questions In the examples presented here and others we have studied, all basic feasible solutions to the dual problem DT (not only the optimal ones) have had integer flows on the “up” arcs and flows equal to either 0, 1, or 1/2 on the “side” arcs. Feasible solutions with other flows have turned out to be non-basic, i.e., not extreme points of the constraint polyhedron. We ask whether what we have observed is true in general. Must every basic feasible solution to the dual problem be a circulation with integer up flows and side flows equal to 0, 1, or 1/2? The labeling functions that are optimal for the total linear discrepancy of a poset are char- acterized in [2] and [5]. We can pose a similar problem for total weak discrepancy. 108 Ars Math. Contemp. 4 (2011) 95–109 • • • • • • a1 a2 a3 a4 a5 a6 [0, 0] [1, 1] [2, 2] [0, 0] [0, 0] [0, 1] 2 OO 1 OO 0 dd 0 ii 0.5 ++ 0.5 kk 1 gg 1 xx 1 ** 1 '' 1 ** 1 uu 0.5 UU 0.5  Figure 7: The poset Y with ranges after applying (3.3), (3.4), (3.5) to the pairs {a2, ai}, i = 3, . . . , 6. When the algorithm terminates, the ranges reduce to the labels on the right side of Figure 2. Which labelings of a poset are optimal for total weak discrepancy? In [7]–[11], we find the range of the fractional weak discrepancy function for semiorders, interval orders, and split semiorders. We can ask analogous questions for total weak dis- crepancy. What is the range of the total weak discrepancy function for various classes of posets? References [1] R. Ahuja, T. Magnanti and J. Orlin, Network flows, Prentice Hall, Englewood Cliffs, NJ, 1993. [2] G. Brightwell and V. Patel, Average relational distance in linear extensions of posets, Discrete Math. 310 (2010), 1016–1021. [3] P. C. Fishburn, P. J. Tanenbaum and A. N. Trenk, Linear discrepancy and bandwidth, Order 18 (2001), 237–245. [4] J. G. Gimbel and A. N. Trenk, On the weakness of an ordered set, SIAM J. Discrete Math. 11 (1998), 655–663. [5] D. Howard, R. Shull, N. Streib and A. Trenk. The Total Linear Discrepancy of an Ordered Set, Discrete Math. 310 (2010), 1022–1025. [6] C.H. Papadimitriou and K. Steiglitz, Combinatorial Optimization, Prentice Hall, Englewood Cliffs, 1981. [7] A. Shuchat, R. Shull and A. Trenk, Range of the fractional weak discrepancy function, Order 23 (2006), 51–63. [8] A. Shuchat, R. Shull and A. Trenk, The fractional weak discrepancy of a partially ordered set, Discrete Applied Math. 155 (2007), 2227–2235. [9] A. Shuchat, R. Shull and A. Trenk, Fractional weak discrepancy of posets and certain forbidden configurations, in: S.J. Brams, W.V. Gehrlein, F.S. Roberts (eds.) The Mathematics of Prefer- A. Shuchat, R. Shull and A. N. Trenk: The total weak discrepancy of a partially ordered set 109 ence, Choice, and Order: Essays in Honor of Peter C. Fishburn, Springer, New York, 2009, 291–302. [10] A. Shuchat, R. Shull and A. Trenk, Fractional weak discrepancy and interval orders, Discrete Applied Math. 157 (2009), 1873-1884. [11] A. Shuchat, R. Shull and A. Trenk, Fractional weak discrepancy and split semiorders, Discrete Applied Math. 159 (2011), 647–660. [12] P. J. Tanenbaum, A. N. Trenk and P. C. Fishburn, Linear discrepancy and weak discrepancy of partially ordered sets, Order 18 (2001), 201–225. [13] A. N. Trenk, On k-weak orders: Recognition and a tolerance result, Discrete Math. 181 (1998), 223–237.