Introduction
We study the many-to-one bipartite matching problem, where we have a bipartite graph G = ( A ∪ P , E ) G = (\mathcal{A} \cup\mathcal{P}, E) G = ( A ∪ P , E ) of applicants A \mathcal{A} A and posts P \mathcal{P} P , in the presence of preferences of applicants over the posts. Typically, every post p ∈ P p \in\mathcal{P} p ∈ P is associated with an input upper quota q + ( p ) q^{+}(p) q + ( p ) that limits the maximum number of applicants assigned to p p p in any allocation. Every applicant ranks all the posts in its neighbourhood, and this ranking can involve ties between the posts. We assume that there are no gaps in the preference list of an applicant. A matching M M M is a collection of edges where an applicant has at most one edge incident to it in M M M , and a post p p p has at most q + ( p ) q^{+}(p) q + ( p ) many edges incident on it in M M M . In the literature, this setting is termed the house allocation setting [2 ] or the one-sided preference list setting, and can be used to model different problems such as assigning applicants to jobs, students to courses [3 ] , papers to referees [4 ] , students to schools [5 ] , and rental inventories to customers [6 ] .
In certain applications, such as allocating students to courses or projects [7 , 8 , 9 ] , a course may require a minimum number of students to be assigned in order to be operational. This can be readily captured by associating a lower quota with a course or post, which denotes the minimum number of applicants that need to be assigned to a post in any feasible allocation. That is, for a post p p p , in addition to the upper quota q + ( p ) q^{+}(p) q + ( p ) , a lower quota q − ( p ) q^{-}(p) q − ( p ) is associated with it. For a matching M M M and a post p p p , M ( p ) M(p) M ( p ) denotes the set of applicants assigned to p p p in M M M . In this setting, a matching M M M is feasible if for every post p p p , q − ( p ) ≤ ∣ M ( p ) ∣ ≤ q + ( p ) q^{-}(p) \le|M(p)| \le q^{+}(p) q − ( p ) ≤ ∣ M ( p ) ∣ ≤ q + ( p ) . We refer to this setting as the fixed quota setting throughout the paper. In the presence of lower quotas, there are simple instances where no feasible matching exists. For example, consider the matching M 1 M_1 M 1 shown in Figure 1 . In M 1 M_1 M 1 , the posts p 3 p_3 p 3 and p 5 p_5 p 5 , marked with red circles, are not assigned any applicants and thus do not meet their lower quotas, and is an infeasible matching in the fixed quota setting.
Figure 1. Example instance G G G with ∣ A ∣ = ∣ P ∣ = 7 |\mathcal{A}| = |\mathcal{P}| = 7 ∣ A ∣ = ∣ P ∣ = 7 . Applicants along with their preferences are given. Preference list of an applicant can be read as: p 1 p_1 p 1 is the rank 1 post of a 3 a_3 a 3 , p 2 p_2 p 2 is the rank 2 post of a 3 a_3 a 3 and so on. Each post has two values – a lower value and an upper value . In the fixed quota setting these numbers represent rigid lower and upper quotas. In the soft quota setting these numbers are the lower and the upper targets, respectively. Matching M 1 M_1 M 1 shown in Figure 1 (iii) is an infeasible matching in the fixed quota setting since the posts p 3 p_3 p 3 and p 5 p_5 p 5 marked with red circles are not assigned their lower quota many applicants. The same matching M 1 M_1 M 1 is a valid assignment in the soft quota setting introduced in this paper.
In many practical applications, quotas need not be as rigid as assumed in the fixed quota setting, and relaxing lower quotas and augmenting upper quotas have been considered in the literature. Lower quotas have been extensively investigated in the two-sided preference list setting called the Hospital Residents problem [10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] . Here, the lower quota of a hospital denotes the minimum number of residents (doctors) needed for the smooth functioning of the hospital. As mentioned earlier, in the presence of lower quotas, a feasible matching may not always exist. Therefore, relaxing these lower quotas has been considered as a solution. For instance, instead of hospitals closing down due to the lack of a minimum number of doctors, they may simply reduce their service levels, as described in the work of Goko et al. [10 ] . Similarly, in the context of school choice, capacity planning to augment the number of available seats has recently been considered in multiple works [18 , 19 , 20 ] . Motivated by such applications, we relax the fixed quota assumption by proposing and studying a soft quota setting for the assignment problem in the one-sided preferences model.
Soft Quota Setting
An instance of the problem in the soft quota setting consists of a bipartite graph G = ( A ∪ P , E ) G = (A \cup P, E) G = ( A ∪ P , E ) where applicants have preferences over posts and a post p p p has two values – a lower target ℓ ( p ) \ell(p) ℓ ( p ) and an upper target u ( p ) u(p) u ( p ) . For a post p p p , the two values ℓ ( p ) \ell(p) ℓ ( p ) and u ( p ) u(p) u ( p ) define a range for the intended number of applicants for p p p in any matching. There is no restriction on the number of applicants that can be assigned to a post in any matching. However, in order to control skew, we define the deviation of a post p p p with respect to a matching M M M as given below:
d M ( p ) = max { 0 , ℓ ( p ) − ∣ M ( p ) ∣ , ∣ M ( p ) ∣ − u ( p ) } . d_M(p) = \max\{0, \ell(p) - |M(p)|, |M(p)| - u(p)\}. d M ( p ) = max { 0 , ℓ ( p ) − ∣ M ( p ) ∣ , ∣ M ( p ) ∣ − u ( p )} .
Our goal in the soft quota setting is to compute an assignment that has two orthogonal optimization objectives:
(i) Minimizing deviation. For a matching M M M , we define the total deviation d t o t ( M ) d_{tot}(M) d t o t ( M ) and maximum deviation d m a x ( M ) d_{max}(M) d ma x ( M ) as below, and our goal is to minimize one of them.
d t o t ( M ) = ∑ p ∈ P d M ( p ) d m a x ( M ) = max p ∈ P d M ( p ) d_{tot}(M) = \sum_{p \in P} d_M(p) \qquad d_{max}(M) = \max_{p \in P} d_M(p) d t o t ( M ) = p ∈ P ∑ d M ( p ) d ma x ( M ) = p ∈ P max d M ( p )
(ii) Optimality with respect to preferences. Two well-studied notions of optimality in the fixed quota setting for the one-sided preference list model are rank-maximality [21 , 22 , 23 , 24 ] , and fairness [25 ] . A rank-maximal matching matches the maximum number of applicants to rank 1 posts, subject to that, the maximum number of applicants to rank 2 posts, and so on. A fair matching minimizes the number of unmatched applicants, subject to that, minimizes the number of applicants matched to the last rank posts, and so on. The signature of a matching allows us to formalize these notions. Let r r r be the maximum rank used by any applicant to order any post in its neighbourhood. The signature of a matching M M M , denoted as σ ( M ) \sigma(M) σ ( M ) , is an r + 1 r + 1 r + 1 tuple ( x 1 , x 2 , … , x r , x r + 1 ) (x_1, x_2, \ldots, x_r, x_{r+1}) ( x 1 , x 2 , … , x r , x r + 1 ) where x i x_i x i denotes the number of applicants matched to their rank i i i post in M M M for i ∈ [ r ] i \in[r] i ∈ [ r ] and x r + 1 x_{r+1} x r + 1 denotes the number of unmatched applicants in M M M .
Definition 1 (Rank-maximality). For two matchings M M M and M ′ M' M ′ with signatures
σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) , \sigma(M) = (x_1, x_2, \ldots, x_r, x_{r+1}) \text{ and } \sigma(M') = (y_1, y_2, \ldots, y_r, y_{r+1}), σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) , we say that M ≻ R M ′ M \succ_R M' M ≻ R M ′ (M M M is more rank-maximal than M ′ M' M ′ ) if there exists an i i i for 1 ≤ i ≤ r 1 \le i \le r 1 ≤ i ≤ r such that x i > y i x_i > y_i x i > y i and, for 1 ≤ j ≤ i − 1 1 \le j \le i - 1 1 ≤ j ≤ i − 1 , we have x j = y j x_j = y_j x j = y j . A matching that has a maximal signature under the ordering ≻ R \succ_R ≻ R is a rank-maximal matching.
Definition 2 (Fairness). For two matchings M M M and M ′ M' M ′ in G G G with signatures
σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) , \sigma(M) = (x_1, x_2, \ldots, x_r, x_{r+1}) \text{ and } \sigma(M') = (y_1, y_2, \ldots, y_r, y_{r+1}), σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) , we say that M ≻ F M ′ M \succ_F M' M ≻ F M ′ (M M M is fairer than M ′ M' M ′ ) if there exists an i i i for 1 < i ≤ r + 1 1 < i \le r + 1 1 < i ≤ r + 1 such that x i < y i x_i < y_i x i < y i and, for i + 1 ≤ j ≤ r + 1 i + 1 \le j \le r + 1 i + 1 ≤ j ≤ r + 1 , we have x j = y j x_j = y_j x j = y j . A matching that has a maximal signature under the ordering ≻ F \succ_F ≻ F is a fair matching.
In the fixed quota setting, where the lower quota of every post is zero, optimal matchings under both these notions are guaranteed to exist and can be efficiently computed using the algorithms given in Irving et al. [21 ] , Paluch [22 ] and Huang et al. [25 ] . Even in the presence of lower quotas, an optimal matching among all feasible matchings can be efficiently computed by extending the algorithm given in Huang et al. [25 ] .
By definition, rank-maximality and fairness optimize the head and tail end of the signature, respectively, and one may perform poorly on the other criterion. Given an input signature ρ \rho ρ , a matching M M M may have a signature that satisfies the optimality requirement with respect to rank-maximality, that is, σ ( M ) ⪰ R ρ \sigma(M) \succeq_R \rho σ ( M ) ⪰ R ρ ; however, this does not guarantee that σ ( M ) ⪰ F ρ \sigma(M) \succeq_F \rho σ ( M ) ⪰ F ρ . A way of comparing two signatures that achieve a trade-off between these extreme notions of optimality is called weak dominance , and was introduced and studied in Santhini et al. [26 , 27 ] .
Definition 3 (Weak dominance). For two matchings M M M and M ′ M' M ′ in G G G with signatures
σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) , \sigma(M) = (x_1, x_2, \ldots, x_r, x_{r+1}) \text{ and } \sigma(M') = (y_1, y_2, \ldots, y_r, y_{r+1}), σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) , we say that M ⪰ D M ′ M \succeq_D M' M ⪰ D M ′ (M M M weakly dominates M ′ M' M ′ ) if
∑ j = 1 ℓ x j ≥ ∑ j = 1 ℓ y j for all ℓ ∈ [ r + 1 ] . \sum_{j=1}^{\ell} x_j \ge\sum_{j=1}^{\ell} y_j \quad\text{for all } \ell\in[r+1]. j = 1 ∑ ℓ x j ≥ j = 1 ∑ ℓ y j for all ℓ ∈ [ r + 1 ] .
In the fixed quota setting, for a given signature, deciding whether the instance admits a matching that weakly dominates the signature is NP-hard [26 , 27 ] .
Our Problems
In our soft quota setting, there is no restriction on the number of applicants that can be assigned to a post. Thus, we care about deviation as well as preference optimality and this defines our problems.
Deviation first, preference optimality next. There exist applications where having as low deviation as possible is required and, subject to that, optimality with respect to preferences needs to be respected. For example, in allocating projects to students [28 ] or dividing political representatives to seats [29 , 30 , 31 ] it is desirable to minimize the difference between input values and the assigned numbers. In a similar spirit, we consider minimizing the deviation from target values. Let M \mathcal{M} M be the set of all matchings in the instance G G G of the soft quota setting. Let M t \mathcal{M}_t M t (M m \mathcal{M}_m M m ) denote the set of matchings that have the minimum value of total deviation (respectively, the minimum value of maximum deviation). This is depicted in Figure 2 (i). We define our first set of problems for the notions of rank-maximality and fairness:
Figure 2. OPT-MIN-Y and OPT-SIGN-MIN-Y illustration, where Y ∈ { t o t , m a x } Y \in\{tot, max\} Y ∈ { t o t , ma x } , and OPT ∈ { R M M , F A I R } \in\{RMM, FAIR\} ∈ { R M M , F A I R }
OPT-MIN-TOT: The goal is to compute a matching that satisfies the notion OPT with respect to preferences in the set M t \mathcal{M}_t M t . For instance, if the notion OPT is rank-maximality, then the problem RMM-MIN-TOT outputs a rank-maximal matching in the set M t \mathcal{M}_t M t .
Preference optimality first, deviation next. Analogously, there exist applications where preference optimality has to be respected first, and subject to that, we would like to minimize a deviation parameter of interest. Since, in the soft quota setting, there is no bound on the upper quota of a post, it is not immediate how to determine the set of matchings in which we wish to compute a rank-maximal or fair matching. To address this, we first introduce an additional input to our problem – a signature requirement, ρ \rho ρ , for the output matching. We consider all matchings in the soft quota setting that respect the signature requirement with respect to the preference optimality under consideration. Having a signature as a part of the input has been considered earlier in Santhini et al. [26 , 27 ] , in the context of a different notion of preference optimality, namely weak dominance .
For a fixed notion of preference optimality, a matching M M M meets the signature requirement if σ ( M ) ⪰ O P T ρ \sigma(M) \succeq_{\mathrm{OPT}} \rho σ ( M ) ⪰ OPT ρ , and let M O P T \mathcal{M}_{\mathrm{OPT}} M OPT denote the set of all matchings that meet the signature requirement, as shown in Figure 2 (ii). Let M t ′ \mathcal{M}'_t M t ′ (M m ′ \mathcal{M}'_m M m ′ ) denote the set of matchings that have minimum value of total deviation (respectively, the minimum value of maximum deviation) in M O P T \mathcal{M}_{\mathrm{OPT}} M OPT . We consider the following two problems for the notions of rank-maximality, fairness and weak dominance:
The order in which we consider the two orthogonal parameters for optimization provides a trade-off between deviation and preference optimality. As expected, when the deviation is optimized first, the output matching has a weak signature. In contrast, when preference optimality is given precedence, a higher deviation is incurred. Thus, our problems offer a trade-off based on the user requirement. To illustrate the optimal solutions for the different problems considered, we use our example instance G G G given in Figure 1 .
Illustrative example
We consider the example instance with seven applicants and seven posts, along with the preferences of applicants over posts, as shown in Figure 1 (i). For each post, two values – a lower value and an upper value – are given, as in Figure 1 (ii). In the soft quota setting, these values represent the lower and the upper targets, respectively. First, we illustrate our problems for the optimality notion of rank-maximality. Table 1 shows the optimal solutions for each of the problems, along with parameters of the matching. We begin by considering the problems of the type deviation first, preference optimality next. See the first two rows of Table 1 . Note that, in the example instance given in Figure 1 , the posts p 2 p_2 p 2 and p 3 p_3 p 3 appear only in the preference list of applicant a 3 a_3 a 3 . Therefore, any matching in the instance must leave one of p 2 p_2 p 2 or p 3 p_3 p 3 unmatched. Similarly, any matching must leave one of p 4 p_4 p 4 or p 5 p_5 p 5 unmatched. Thus, we make the following useful observation.
Table 1. Optimal matchings in the instance given in Figure 1 corresponding to our problems. For the preference optimality first type problems, we consider the input signature as (4, 0, 0, 3). We consider preference optimality as rank-maximality.
Observation 1. Any matching in the example instance given in Figure 1 must have a maximum deviation of at least one and a total deviation of at least two.
It can be verified that the matchings M 1 M_1 M 1 and M 2 M_2 M 2 shown in Table 1 are optimal for the problems RMM-MIN-TOT and RMM-MIN-MAX respectively.
Now we turn to problems where preference optimality is considered first and, subject to that, deviation is minimized. For concreteness, we fix the requirement for signature as ( 4 , 0 , 0 , 3 ) (4, 0, 0, 3) ( 4 , 0 , 0 , 3 ) . In order to meet the signature requirement, we must violate the upper target of the post p 1 p_1 p 1 by 2, and hence the maximum deviation of any matching in M R \mathcal{M}_{R} M R is at least 2. From Observation 1, the sum of lower deviations over all posts (the total lower deviation) of any matching in the instance must be at least 2, and therefore the total deviation of any matching in M R \mathcal{M}_{R} M R is at least 4. Furthermore, it can be verified that the matchings M 3 M_3 M 3 and M 4 M_4 M 4 shown in Table 1 are optimal for the problems RMM-SIGN-MIN-TOT and RMM-SIGN-MIN-MAX respectively.
Note that the signatures of the matchings M 3 M_3 M 3 and M 4 M_4 M 4 weakly dominate the input signature, and hence both these matchings are candidate solutions for the problems DOM-SIGN-MIN-TOT and DOM-SIGN-MIN-MAX respectively, where DOM represents the optimality notion of weak dominance.
Next, we illustrate our problems and their solutions for the notion of fairness using the example instance G G G given in Figure 1 . Table 2 shows the optimal solutions for each of the problems, along with the parameters of the matching. Note that these matchings are different from the matchings given in Table 1 . We first consider the problems of the type deviation first, preference optimality next. From Observation 1, any matching in G G G must have a maximum deviation of at least one and a total deviation of at least two. It can be verified that the matchings M 5 M_5 M 5 and M 6 M_6 M 6 shown in Table 2 are optimal for the problems FAIR-MIN-TOT and FAIR-MIN-MAX respectively.
Table 2. Optimal matchings in the instance given in Figure 1 corresponding to our problems. For the preference optimality first type problems, we consider the input signature as ( 4 , 0 , 3 , 0 ) (4,0,3,0) ( 4 , 0 , 3 , 0 ) . We consider preference optimality as fairness.
Now, we turn to problems where preference optimality is considered first and subject to that deviation is minimized. For concreteness, we fix the signature as ( 4 , 0 , 3 , 0 ) (4,0,3,0) ( 4 , 0 , 3 , 0 ) . The input signature can be interpreted as follows: the value of 0 in the last component indicates that the required matching must assign all applicants, while the value 3 specifies that at most 3 applicants can be matched to a rank 3 post. Any matching whose signature is fairer than the input signature is a candidate solution. Observe that in order to match all applicants, any matching must either violate the upper target of post p 1 p_1 p 1 by 2 or violate the upper targets of the post p 1 p_1 p 1 and one of p 6 p_6 p 6 or p 7 p_7 p 7 by 1 each. Thus, the maximum deviation of any matching in M F \mathcal{M}_F M F must be at least 1. From Observation 1, the total lower deviation of any matching in the instance must be at least 2, making the total deviation of any matching in M F \mathcal{M}_F M F at least 4. Furthermore, it can be verified that matchings M 7 M_7 M 7 and M 6 M_6 M 6 , shown in Table 2 , are optimal for the FAIR-SIGN-MIN-TOT and FAIR-SIGN-MIN-MAX problems, respectively.
Our Results
We show the following new results in our paper.
Theorem 4. OPT-SIGN-MIN-MAX and OPT-SIGN-MIN-TOT admit polynomial time algorithms, where OPT can be one of rank-maximality (RMM) or fairness (FAIR).
Theorem 5. OPT-MIN-MAX and OPT-MIN-TOT admit polynomial time algorithms, where OPT can be one of rank-maximality or fairness.
Proposition 1. DOM-SIGN-MIN-MAX and DOM-SIGN-MIN-TOT are N P NP N P -hard even when all applicants have strict preferences, the total deviation k = 0 k = 0 k = 0 , and for every post p ∈ P p \in\mathcal{P} p ∈ P , the lower target ℓ ( p ) = 0 \ell(p) = 0 ℓ ( p ) = 0 , and the upper target $u(p) = 1.
The above hardness is obtained from the hardness of DOM-Q problem considered in [27 ] by viewing quotas as targets.
Our Techniques. The algorithms for computing minimum total deviation matchings are based on a flow network that we design. Flow networks are used to compute Pareto-optimal matchings [32 , 33 , 9 ] , rank-maximal matchings [34 ] and weakly dominant matchings [27 , 26 ] in the literature. For computing matchings with minimum value of maximum deviation we reduce the problem to an appropriate problem in the fixed quota setting, which can be solved efficiently.
Generalized soft quota setting. Given our positive results for the problems in the soft quota setting for the optimality notions rank-maximality and fairness, it is natural to consider a generalization of our setting, where every deviation is associated with a cost. That is, every post p p p in the generalized soft quota setting is associated with a lower deviation cost c ℓ ( p ) c_\ell(p) c ℓ ( p ) and an upper deviation cost c u ( p ) c_u(p) c u ( p ) that indicate the cost associated with deviating 1 unit from the lower target and upper target, respectively. We show extensions of our algorithms in § 7 .
Related Works
Biproportional apportionment. Our soft quota setting is similar to the biproportional apportionment problem [29 , 30 , 31 ] , which deals with the fair division of political representatives among states. Political representatives correspond to applicants, and states correspond to posts in our model. Many methods [30 , 31 ] for the biproportional apportionment problem reduce the problem to a flow network to minimize the absolute or relative min-max error. Note that the min-max error in the biproportional apportionment problem considered in the works of Pukelsheim et al. [30 ] and Serafini and Simeone [31 ] corresponds to the min-max deviation in our model. However, the biproportional apportionment problem does not involve any preferences, whereas in our setting we have preferences associated with edges.
Soft bounds. The recent works [35 , 36 , 37 , 38 , 39 ] in the two-sided preferences model allow soft bounds on the capacity constraints. These works focus on the controlled school choice problem, in which students are associated with types and schools have soft bounds on the quota of each type. However, there are hard constraints on the number of students that can be assigned to each school or type. In the work by Aziz et al. [38 ] and Echenique and Yenmez [36 ] , lower-side deviation (or relaxation) from the target quotas or reserves is allowed. Our model has no hard capacity constraints, and target soft quotas are allowed to deviate on both sides. In the work by Ehlers et al. [35 ] , students are associated with a single type, and for each type, there is a lower violation and upper violation w.r.t. an allocation, and these are analogous to the lower deviation and upper deviation in our model. Gonczarowski et al. [37 ] considered a matching problem in the two-sided matching market with soft diversity constraints that allocate candidates to Pre-Military Academics programs (PMA). Here, each PMA defines a set of populations (or types) that they are interested, and specifies a soft minimum target and hard maximum quota for such populations. For more information, refer to the survey paper by Aziz et al. [40 ] .
Other models of flexibility. In the context of school choice problem, capacity planning is studied in [41 , 42 , 19 , 18 , 43 ] . In the work by Gajulapalli et al. [41 ] , flexible quotas are used to increase the capacity of some schools. In the work by Rios et al. [42 ] , flexible quotas are used as a tie-breaker. In the work by Bobbio et al. [19 ] , the authors study the school choice problem in an expanded market, where some schools can increase their capacity to either allocate students who are previously unassigned or to improve the assignment of the previously assigned students. The budget used for capacity expansion in the work by Bobbio et al. [19 ] is analogous to the total upper deviation of posts in our model. In Abe et al. [18 ] , Monte Carlo tree search based solutions for the capacity expansion problem are studied. In the work of Limaye and Nasre [44 ] and Santhini et al. [27 , 26 ] , programs have costs instead of quotas, which allows flexibility. In all these works, the flexibility of upper quotas is considered, whereas in our work, we allow posts to deviate on both upper and lower targets.
To the best of our knowledge, this is the first work that investigates soft quotas in the one-sided preference list model.
Our problems consider optimizing two objective functions – deviation and preference optimality – and hence can be regarded as a special case of a multi-objective optimization problem [45 , 46 , 47 ] . These works differ from our work in terms of the problem setup and the objectives considered.
Organization of the paper. Throughout the paper, we present the results with OPT set to rank-maximality (RMM). Analogous results for fairness can be obtained with minor modifications to our algorithms, as outlined in the relevant sections. In § 3 and § 4 , we focus on problems where the objective is to minimize the total deviation. The former section addresses preference-optimality-first type problems (the MIN-TOT variant in Theorem 4), while the latter discusses deviation-first type problems (the MIN-TOT variant in Theorem 5). In § 5 , we present results for the MIN-MAX problems by exploiting the connection between the fixed quota setting and the soft quota setting. § 6 explores the simultaneous optimization of total deviation and maximum deviation. Results for the generalized soft quota setting are described in § 7 , and we conclude with a discussion in § 8 .
Minimizing Total Deviation: Preference Optimality First
In this section, we present the results for minimizing total deviation for the preference optimality first, deviation next type of problems. As mentioned earlier, apart from the input instance these problems have a signature as part of the input. Recall that OPT can be instantiated with either rank-maximality or fairness. We present the results for rank-maximality in detail and state the necessary modifications required for fairness.
An instance of RMM-SIGN-MIN-TOT problem consists of a graph G G G with applicant preferences, soft quotas for posts, and an input signature ρ \rho ρ . Let M R \mathcal{M}_{R} M R denote the set of matchings such that, for every M ∈ M R M \in\mathcal{M}_{R} M ∈ M R , we have σ ( M ) ⪰ R ρ \sigma(M) \succeq_{R} \rho σ ( M ) ⪰ R ρ . Our goal is to output a matching M M M that has minimum total deviation in the set M R \mathcal{M}_{R} M R . We present a flow-network based algorithm to solve the RMM-SIGN-MIN-TOT problem.
Overall idea. Consider an optimal matching M ∗ M^{*} M ∗ for the RMM-SIGN-MIN-TOT problem. Let the total deviation of M ∗ M^{*} M ∗ be Δ ∗ \Delta^{*} Δ ∗ . In M ∗ M^{*} M ∗ , a subset of posts incur deviation with respect to the lower target, whereas another subset of posts, disjoint from the previous set, incur deviation with respect to the upper target. Let l d ∗ ld^{*} l d ∗ (u d ∗ ud^{*} u d ∗ ) denote the sum of the deviation of posts that deviate with respect to the lower target (respectively, with respect to the upper target). Note that Δ ∗ = l d ∗ + u d ∗ \Delta^{*} = ld^{*} + ud^{*} Δ ∗ = l d ∗ + u d ∗ . Our algorithm considers all possible values of l d ld l d and u d ud u d such that l d + u d = Δ ld + ud = \Delta l d + u d = Δ . We show that there exists a flow network H ( l d ∗ , u d ∗ ) H_{(ld^{*},ud^{*})} H ( l d ∗ , u d ∗ ) such that the matching M ∗ M^{*} M ∗ has a feasible flow f ∗ f^{*} f ∗ in H ( l d ∗ , u d ∗ ) H_{(ld^{*},ud^{*})} H ( l d ∗ , u d ∗ ) . For a fixed value of Δ \Delta Δ and a split of Δ \Delta Δ as l d + u d ld + ud l d + u d , we construct a flow network with properties as specified below.
Construction of the network
For a given instance G G G , and a fixed value of Δ \Delta Δ , which can be split as the sum of two non-negative integers l d ld l d and u d ud u d , we construct the flow network H ( l d , u d ) = ( V H , E H ) H_{(ld,ud)} = (V_{H}, E_{H}) H ( l d , u d ) = ( V H , E H ) with costs, demands and capacities on the edges. The vertices of H ( l d , u d ) H_{(ld,ud)} H ( l d , u d ) are:
V H = { s , d ′ , d ′ ′ , t } ∪ A ∪ { p ′ , p ′ ′ : p ∈ P } . V_{H} = \{s, d', d'', t\} \cup\mathcal{A} \cup\{p',p'' : p \in\mathcal{P}\}. V H = { s , d ′ , d ′′ , t } ∪ A ∪ { p ′ , p ′′ : p ∈ P } .
For every applicant a a a in G G G , we have a node a a a in V H V_{H} V H . For every post p p p in G G G , we have two nodes in V H V_{H} V H , namely, p ′ p' p ′ (termed the original copy) and p ′ ′ p'' p ′′ (termed the extended copy). In addition, we have a source s s s , a sink t t t , and two special nodes d ′ d' d ′ and d ′ ′ d'' d ′′ .
Demand and capacity of the edges in E H E_{H} E H . Every edge e ∈ E H e \in E_{H} e ∈ E H has a demand and a capacity associated with it, and we use a vector [ q − ( e ) , q + ( e ) ] [q^{-}(e),q^{+}(e)] [ q − ( e ) , q + ( e )] to denote these values. The edge set E H E_{H} E H is the union of the following sets:
E 1 = { ( s , a ) : a ∈ A } \mathcal{E}_1=\{(s,a):a\in A\} E 1 = {( s , a ) : a ∈ A } with vector [ 0 , 1 ] [0,1] [ 0 , 1 ]
E 2 = { ( a , p ′ ) , ( a , p ′ ′ ) : ( a , p ) ∈ E } \mathcal{E}_2=\{(a,p^{\prime}),(a,p^{\prime\prime}):(a,p)\in E\} E 2 = {( a , p ′ ) , ( a , p ′′ ) : ( a , p ) ∈ E } with vector [ 0 , 1 ] [0,1] [ 0 , 1 ]
E 3 = { ( p ′ , t ) : p ∈ P } \mathcal{E}_3=\{(p^{\prime},t):p\in P\} E 3 = {( p ′ , t ) : p ∈ P } with vector [ ℓ ( p ) , u ( p ) ] [\ell(p),u(p)] [ ℓ ( p ) , u ( p )]
E 4 = { ( p ′ ′ , d ′ ′ ) : p ∈ P } \mathcal{E}_4=\{(p^{\prime\prime},d^{\prime\prime}):p\in P\} E 4 = {( p ′′ , d ′′ ) : p ∈ P } with vector [ 0 , u d ] [0,ud] [ 0 , u d ]
E 5 = { ( d ′ , p ′ ) : p ∈ P } \mathcal{E}_5=\{(d^{\prime},p^{\prime}):p\in P\} E 5 = {( d ′ , p ′ ) : p ∈ P } with vector [ 0 , l d ] [0,ld] [ 0 , l d ]
E 6 = { ( s , d ′ ) , ( d ′ ′ , t ) } \mathcal{E}_6=\{(s,d^{\prime}),(d^{\prime\prime},t)\} E 6 = {( s , d ′ ) , ( d ′′ , t )} with vectors [ l d , l d ] [ld,ld] [ l d , l d ] and [ u d , u d ] [ud,ud] [ u d , u d ] respectively
Cost of the edges in E H E_H E H . All the edges in E H E_H E H , except the edges in E 2 \mathcal{E}_2 E 2 , have a cost of 0. For an edge ( a , p ) (a,p) ( a , p ) in G G G of rank i i i , the corresponding two edges ( a , p ′ ) (a,p^{\prime}) ( a , p ′ ) and ( a , p ′ ′ ) (a,p^{\prime\prime}) ( a , p ′′ ) in E 2 \mathcal{E}_2 E 2 have a cost of − ( n + 1 ) r − i -(n+1)^{r-i} − ( n + 1 ) r − i , where n = ∣ A ∣ n=|A| n = ∣ A ∣ .
As in standard reductions, there is a natural correspondence between edges in E 2 \mathcal{E}_2 E 2 carrying non-zero flow and a matching. With this, we complete the description of the flow network. See Figure 3 for an illustration. A flow f f f in H ( l d , u d ) H_{(ld,ud)} H ( l d , u d ) is said to be a feasible flow if it meets the demands on every edge e ∈ f ∩ E H e\in f\cap E_H e ∈ f ∩ E H . The cost of a feasible flow f f f , denoted by c o s t ( f ) cost(f) cos t ( f ) is defined as
Figure 3. Flow network H ( l d , u d ) H_{(ld,ud)} H ( l d , u d ) for solving RMM-SIGN-MIN-TOT, where Δ = l d + u d \Delta= ld + ud Δ = l d + u d
∑ e ∈ E H f ( e ) ⋅ c o s t ( e ) \sum_{e\in E_H} f(e)\cdot cost(e) e ∈ E H ∑ f ( e ) ⋅ cos t ( e )
where f ( e ) f(e) f ( e ) and c o s t ( e ) cost(e) cos t ( e ) denotes the flow across the edge e e e and cost assigned on the edge e e e , respectively. For a matching M M M with signature σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) \sigma(M)=(x_1,x_2,\ldots,x_r,x_{r+1}) σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) , we define the cost of M M M , denoted by c o s t ( M ) cost(M) cos t ( M ) as
− ∑ j = 1 r x j ⋅ ( n + 1 ) r − j . -\sum_{j=1}^{r}x_j\cdot(n+1)^{r-j}. − j = 1 ∑ r x j ⋅ ( n + 1 ) r − j .
We have the following lemma regarding the cost assignment.
Lemma 1. Let M , M ′ M,M^{\prime} M , M ′ be matchings such that σ ( M ) ≻ R σ ( M ′ ) \sigma(M)\succ_R\sigma(M^{\prime}) σ ( M ) ≻ R σ ( M ′ ) . Then, c o s t ( M ) < c o s t ( M ′ ) cost(M)<cost(M^{\prime}) cos t ( M ) < cos t ( M ′ ) , where each rank i i i edge has a cost of − ( n + 1 ) r − i -(n+1)^{r-i} − ( n + 1 ) r − i .
Proof. Let σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) \sigma(M)=(x_1,x_2,\ldots,x_r,x_{r+1}) σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) , and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) \sigma(M^{\prime})=(y_1,y_2,\ldots,y_r,y_{r+1}) σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) . Let i i i be the first rank at which σ ( M ) \sigma(M) σ ( M ) and σ ( M ′ ) \sigma(M^{\prime}) σ ( M ′ ) differ. Thus, x j = y j x_j=y_j x j = y j for all j < i j<i j < i , and x i > y i x_i>y_i x i > y i .
The cost difference between the matchings M M M and M ′ M^{\prime} M ′ is
c o s t ( M ′ ) − c o s t ( M ) = ∑ j = 1 r ( x j − y j ) ( n + 1 ) r − j = ( x i − y i ) ( n + 1 ) r − i + ∑ j = i + 1 r ( x j − y j ) ( n + 1 ) r − j . cost(M^{\prime})-cost(M)=\sum_{j=1}^{r}(x_j-y_j)(n+1)^{r-j}=(x_i-y_i)(n+1)^{r-i}+\sum_{j=i+1}^{r}(x_j-y_j)(n+1)^{r-j}. cos t ( M ′ ) − cos t ( M ) = j = 1 ∑ r ( x j − y j ) ( n + 1 ) r − j = ( x i − y i ) ( n + 1 ) r − i + j = i + 1 ∑ r ( x j − y j ) ( n + 1 ) r − j .
Now, since x i − y i ≥ 1 x_i-y_i\geq1 x i − y i ≥ 1 , we have
c o s t ( M ′ ) − c o s t ( M ) ≥ ( n + 1 ) r − i + ∑ j = i + 1 r ( x j − y j ) ( n + 1 ) r − j ≥ ( n + 1 ) r − i − ∑ j = i + 1 r y j ( n + 1 ) r − j ≥ ( n + 1 ) r − i − ( ∑ j = i + 1 r y j ) ( n + 1 ) r − i − 1 . \begin{aligned}
cost(M^{\prime})-cost(M)\geq(n+1)^{r-i}+\sum_{j=i+1}^{r}(x_j-y_j)(n+1)^{r-j} \\
&\geq(n+1)^{r-i}-\sum_{j=i+1}^{r}y_j(n+1)^{r-j} \\
&\geq(n+1)^{r-i}-\left(\sum_{j=i+1}^{r}y_j\right)(n+1)^{r-i-1}.
\end{aligned} cos t ( M ′ ) − cos t ( M ) ≥ ( n + 1 ) r − i + j = i + 1 ∑ r ( x j − y j ) ( n + 1 ) r − j ≥ ( n + 1 ) r − i − j = i + 1 ∑ r y j ( n + 1 ) r − j ≥ ( n + 1 ) r − i − ( j = i + 1 ∑ r y j ) ( n + 1 ) r − i − 1 .
Additionally, using the fact that ∑ j = i + 1 r y j ≤ ∑ j = 1 r y j ≤ n \sum_{j=i+1}^{r}y_j\leq\sum_{j=1}^{r}y_j\leq n ∑ j = i + 1 r y j ≤ ∑ j = 1 r y j ≤ n , we conclude that
c o s t ( M ′ ) − c o s t ( M ) ≥ ( n + 1 ) r − i − n ( n + 1 ) r − i − 1 = ( n + 1 ) r − i − 1 > 0. cost(M^{\prime})-cost(M)\geq(n+1)^{r-i}-n(n+1)^{r-i-1}=(n+1)^{r-i-1}>0. cos t ( M ′ ) − cos t ( M ) ≥ ( n + 1 ) r − i − n ( n + 1 ) r − i − 1 = ( n + 1 ) r − i − 1 > 0.
We have the following remark regarding the cost assignment.
Proof: Let f f f be a min-cost feasible flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) , and let M f M_f M f be the corresponding matching in M ( l d , u d ) \mathcal{M}_{(l_d,u_d)} M ( l d , u d ) . Suppose, for contradiction, that M f M_f M f is not a rank-maximal matching in M ( l d , u d ) \mathcal{M}_{(l_d,u_d)} M ( l d , u d ) . Then there exists another matching M ′ ∈ M ( l d , u d ) M' \in\mathcal{M}_{(l_d,u_d)} M ′ ∈ M ( l d , u d ) such that σ ( M ′ ) ≻ R σ ( M f ) \sigma(M') \succ_R \sigma(M_f) σ ( M ′ ) ≻ R σ ( M f ) . By Lemma 1, c o s t ( M ′ ) < c o s t ( M f ) cost(M') < cost(M_f) cos t ( M ′ ) < cos t ( M f ) . Since M ′ ∈ M ( l d , u d ) M' \in\mathcal{M}_{(l_d,u_d)} M ′ ∈ M ( l d , u d ) , there exists a feasible flow f ′ f' f ′ corresponding to M ′ M' M ′ , with c o s t ( f ′ ) = c o s t ( M ′ ) cost(f') = cost(M') cos t ( f ′ ) = cos t ( M ′ ) , contradicting the minimality of f f f .
It is worth noting that our reductions apply to any notion of optimality that can be encoded as a maximum weight matching problem.
Total deviation of a flow versus total deviation of the corresponding matching
The flow network H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) has demands on its edges, and thus it may not admit a feasible flow. Assume that H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) admits a feasible flow, say f f f . There is a natural correspondence between the flow f f f in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) and a matching M M M in G G G as follows:
M = { ( a , p ) ∣ f ( a , p ′ ) = 1 or f ( a , p ′ ′ ) = 1 , a ∈ A , p ∈ P } . M = \{(a,p) \mid f(a,p') = 1 \text{ or } f(a,p'') = 1,\ a \in\mathcal{A},\ p \in\mathcal{P}\}. M = {( a , p ) ∣ f ( a , p ′ ) = 1 or f ( a , p ′′ ) = 1 , a ∈ A , p ∈ P } .
For any applicant a a a , the edge ( s , a ) (s,a) ( s , a ) has unit capacity, and hence the incoming flow, if any, is routed either via the node p ′ p' p ′ or via p ′ ′ p'' p ′′ , but not both. For a feasible flow f f f , we define the deviation of a flow as follows. For the node p ′ p' p ′ , we define the lower deviation of p ′ p' p ′ with respect to the flow f f f as f ( d ′ , p ′ ) f(d',p') f ( d ′ , p ′ ) , and the upper deviation is undefined for this node. For the node p ′ ′ p'' p ′′ , we define the upper deviation of p ′ ′ p'' p ′′ with respect to f f f as f ( p ′ ′ , d ′ ′ ) f(p'',d'') f ( p ′′ , d ′′ ) , and the lower deviation is undefined for this node. For a post p ∈ P p \in\mathcal{P} p ∈ P , we define the total deviation of p p p with respect to f f f as
d f ( p ) = f ( d ′ , p ′ ) + f ( p ′ ′ , d ′ ′ ) . d_f(p) = f(d',p') + f(p'',d''). d f ( p ) = f ( d ′ , p ′ ) + f ( p ′′ , d ′′ ) .
Similar to the definition of total deviation of a matching, we define total deviation of the flow f f f in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) as follows.
Definition 6 (Total deviation of a flow). The total deviation of a flow f f f in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) is defined as
d t o t ( f ) = ∑ p ∈ P f ( d ′ , p ′ ) + f ( p ′ ′ , d ′ ′ ) . d_{\mathrm{tot}}(f) = \sum_{p \in\mathcal{P}} f(d',p') + f(p'',d''). d tot ( f ) = p ∈ P ∑ f ( d ′ , p ′ ) + f ( p ′′ , d ′′ ) .
By the construction of the network H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) , and by the definition of total deviation of a feasible flow f f f in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) , it is easy to verify that d t o t ( f ) = Δ = l d + u d d_{\mathrm{tot}}(f) = \Delta= l_d + u_d d tot ( f ) = Δ = l d + u d .
Some pathological cases. Having defined the correspondence between a flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) and a matching, it would be ideal to have a correspondence between the total deviation of a flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) and that of the matching. However, even for a single post, the total deviation of the post with respect to the flow need not be the same as the total deviation of the post with respect to the corresponding matching. This is illustrated by three scenarios presented below. For all the three scenarios, we consider an input graph G G G that has a single edge ( a , p ) (a,p) ( a , p ) , and the post p p p has ℓ ( p ) = 0 \ell(p) = 0 ℓ ( p ) = 0 and u ( p ) = 1 u(p) = 1 u ( p ) = 1 .
Scenario 1: Consider the flow network H ( 1 , 1 ) H_{(1,1)} H ( 1 , 1 ) for Δ = 2 \Delta= 2 Δ = 2 . The network H ( 1 , 1 ) H_{(1,1)} H ( 1 , 1 ) admits a feasible flow f f f with value 2 that routes 1 unit of flow through the path ⟨ s , d ′ , p ′ , t ⟩ \langle s,d',p',t\rangle ⟨ s , d ′ , p ′ , t ⟩ and 1 unit of flow through the path ⟨ s , a , p ′ ′ , d ′ ′ , t ⟩ \langle s,a,p'',d'',t\rangle ⟨ s , a , p ′′ , d ′′ , t ⟩ , and has a total deviation d t o t ( f ) = 2 d_{tot}(f) = 2 d t o t ( f ) = 2 (see Figure 4 (i) for an illustration). Since f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 , the post p p p has a lower deviation with respect to the flow f f f . Similarly, p p p has an upper deviation due to the non-zero flow across the edge ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) . Thus, the flow f f f has a total deviation d t o t ( f ) = 2 d_{tot}(f) = 2 d t o t ( f ) = 2 , as mentioned earlier. The matching corresponding to f f f contains a single edge ( a , p ) (a,p) ( a , p ) and has a total deviation of 0. Thus, there is a mismatch between the total deviation of the flow and the total deviation of the corresponding matching. We remark that this issue arises because, for the same post p p p , both the edge corresponding to its original copy ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and the edge corresponding to its extended copy ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) carry non-zero flow. This issue can be avoided by ensuring that, for every post p p p , at most one of the edges ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) carries non-zero flow in f f f .
(a) Scenario 1: Total deviation of the flow f f f (marked in red) is 2 and that of the corresponding matching M = { ( a , p ) } M = \{(a,p)\} M = {( a , p )} is 0. The example illustrates the violation of Property 1.(i) in the network H ( 1 , 1 ) H_{(1,1)} H ( 1 , 1 ) and thus f f f is not a good flow.
(b) An ( l d , u d ) (ld,ud) ( l d , u d ) -correcting flow f ′ f' f ′ (marked in green) in H ( 1 , 1 ) H_{(1,1)} H ( 1 , 1 ) which is feasible in the network H ( 0 , 0 ) H_{(0,0)} H ( 0 , 0 ) and fixes the violation of Property 1.(i). Note that the total deviation of f ′ f' f ′ is 0 and that of the corresponding matching M = { ( a , p ) } M = \{(a,p)\} M = {( a , p )} is 0.
Figure 4. Scenario 1 where d t o t ( f ) ≠ d t o t ( M ) d_{tot}(f) \ne d_{tot}(M) d t o t ( f ) = d t o t ( M ) and the ( l d , u d ) (ld,ud) ( l d , u d ) -correcting flow f ′ f' f ′ .
Scenario 2: Consider the flow network H ( 0 , 1 ) H_{(0,1)} H ( 0 , 1 ) for Δ = 1 \Delta= 1 Δ = 1 . The network H ( 0 , 1 ) H_{(0,1)} H ( 0 , 1 ) admits a feasible flow f f f with value 1 that routes 1 unit of flow through the path ⟨ s , a , p ′ ′ , d ′ ′ , t ⟩ \langle s,a,p'',d'',t\rangle ⟨ s , a , p ′′ , d ′′ , t ⟩ and has a total deviation d t o t ( f ) = 1 d_{tot}(f) = 1 d t o t ( f ) = 1 . However, the matching corresponding to f f f contains a single edge ( a , p ) (a,p) ( a , p ) and has a total deviation of 0. Note that here f ( p ′ , t ) = 0 < u ( p ) f(p',t) = 0 < u(p) f ( p ′ , t ) = 0 < u ( p ) and f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 . For a feasible flow f f f , when f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 , the post p p p has an upper deviation, and we expect the flow across the edge ( p ′ , t ) (p',t) ( p ′ , t ) to be saturated. However, this need not be true, as illustrated in the example. This situation can be avoided if the edge ( p ′ , t ) (p',t) ( p ′ , t ) is saturated in f f f whenever f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 .
Scenario 3: Consider the flow network H ( 1 , 0 ) H_{(1,0)} H ( 1 , 0 ) for Δ = 1 \Delta= 1 Δ = 1 . The network H ( 1 , 0 ) H_{(1,0)} H ( 1 , 0 ) admits a feasible flow f f f with value 1 that routes 1 unit of flow through the path ⟨ s , d ′ , p ′ , t ⟩ \langle s,d',p',t\rangle ⟨ s , d ′ , p ′ , t ⟩ and has a total deviation d t o t ( f ) = 1 d_{tot}(f) = 1 d t o t ( f ) = 1 . Note that here f ( p ′ , t ) = 1 > ℓ ( p ) f(p',t) = 1 > \ell(p) f ( p ′ , t ) = 1 > ℓ ( p ) and f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 . The matching corresponding to f f f is an empty matching and has a total deviation of 0. When we route flow along the edge ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) , we expect the flow across the edge ( p ′ , t ) (p',t) ( p ′ , t ) to be exactly equal to its demand ℓ ( p ) \ell(p) ℓ ( p ) . However, this need not be true, as illustrated in the example. This situation can be avoided if the flow across the edge ( p ′ , t ) (p',t) ( p ′ , t ) in f f f is exactly equal to its demand whenever f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 .
Good flow and correcting flow
To address the discrepancies as illustrated in the pathological cases and ensure that the total deviation of the flow corresponds to the total deviation of the matching, a feasible flow in our flow network should satisfy additional properties, which are listed below as Property 1.
Property 1. Let f f f be a feasible flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) . The flow f f f is good if, for every post p ∈ P p \in\mathcal{P} p ∈ P , all of the following hold.
(i) at most one of the edges ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) has a non-zero flow in f f f
(ii) if f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 then f ( p ′ , t ) = u ( p ) f(p',t) = u(p) f ( p ′ , t ) = u ( p )
(iii) if f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 then f ( p ′ , t ) = ℓ ( p ) f(p',t) = \ell(p) f ( p ′ , t ) = ℓ ( p )
We note a useful observation below about good flows.
Observation 2. Let f f f be a good flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) , and let M M M be the corresponding matching in G G G . Then, for every post p ∈ P p \in\mathcal{P} p ∈ P , d f ( p ) = d M ( p ) d_f(p) = d_M(p) d f ( p ) = d M ( p ) . Therefore, d t o t ( f ) = d t o t ( M ) d_{\mathrm{tot}}(f) = d_{\mathrm{tot}}(M) d tot ( f ) = d tot ( M ) .
Proof: Let f f f be a good flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) , and thus f f f satisfies Property 1. By Property 1(i), for a post p p p , at most one of the edges in ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) has a non-zero flow. Now consider the matching M M M corresponding to f f f . Observe that, for a post p p p , the number of applicants that are matched to p p p in M M M is ∣ M ( p ) ∣ = f ( p ′ ′ , d ′ ′ ) + f ( p ′ , t ) − f ( d ′ , p ′ ) |M(p)| = f(p'',d'') + f(p',t) - f(d',p') ∣ M ( p ) ∣ = f ( p ′′ , d ′′ ) + f ( p ′ , t ) − f ( d ′ , p ′ ) . Recall that the deviation of p p p in M M M is d M ( p ) = max { 0 , ℓ ( p ) − ∣ M ( p ) ∣ , ∣ M ( p ) ∣ − u ( p ) } d_M(p) = \max\{0,\ell(p)-|M(p)|,|M(p)|-u(p)\} d M ( p ) = max { 0 , ℓ ( p ) − ∣ M ( p ) ∣ , ∣ M ( p ) ∣ − u ( p )} . We consider the following cases.
Case 1: p ∈ P p \in\mathcal{P} p ∈ P : f ( d ′ , p ′ ) = f ( p ′ ′ , d ′ ′ ) = 0 f(d',p') = f(p'',d'') = 0 f ( d ′ , p ′ ) = f ( p ′′ , d ′′ ) = 0 . Observe that, in this case, d f ( p ) = 0 d_f(p) = 0 d f ( p ) = 0 . Since f ( p ′ ′ , d ′ ′ ) = 0 f(p'',d'') = 0 f ( p ′′ , d ′′ ) = 0 , the node p ′ ′ p'' p ′′ does not have any non-zero flow into it in f f f , which implies that ∣ M ( p ) ∣ = f ( p ′ , t ) ≤ u ( p ) |M(p)| = f(p',t) \leq u(p) ∣ M ( p ) ∣ = f ( p ′ , t ) ≤ u ( p ) . Since f ( d ′ , p ′ ) = 0 f(d',p') = 0 f ( d ′ , p ′ ) = 0 , all the flow along the edge ( p ′ , t ) (p',t) ( p ′ , t ) comes from applicants in A \mathcal{A} A (true applicants), and because f f f is a feasible flow, ∣ M ( p ) ∣ ≥ ℓ ( p ) |M(p)| \geq\ell(p) ∣ M ( p ) ∣ ≥ ℓ ( p ) . Therefore, d M ( p ) = 0 = d f ( p ) d_M(p) = 0 = d_f(p) d M ( p ) = 0 = d f ( p ) .
Case 2: p ∈ P p \in\mathcal{P} p ∈ P : f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 , and f ( d ′ , p ′ ) = 0 f(d',p') = 0 f ( d ′ , p ′ ) = 0 . Observe that d f ( p ) = f ( p ′ ′ , d ′ ′ ) d_f(p) = f(p'',d'') d f ( p ) = f ( p ′′ , d ′′ ) . In this case, by Property 1(ii), f ( p ′ , t ) = u ( p ) f(p',t) = u(p) f ( p ′ , t ) = u ( p ) , and since f ( d ′ , p ′ ) = 0 f(d',p') = 0 f ( d ′ , p ′ ) = 0 , all the flow along the edge ( p ′ , t ) (p',t) ( p ′ , t ) is via the true applicants. Thus, ∣ M ( p ) ∣ = u ( p ) + f ( p ′ ′ , d ′ ′ ) |M(p)| = u(p) + f(p'',d'') ∣ M ( p ) ∣ = u ( p ) + f ( p ′′ , d ′′ ) , and this implies that d M ( p ) = f ( p ′ ′ , d ′ ′ ) = d f ( p ) d_M(p) = f(p'',d'') = d_f(p) d M ( p ) = f ( p ′′ , d ′′ ) = d f ( p ) .
Case 3: p ∈ P p \in\mathcal{P} p ∈ P : f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 , and f ( p ′ ′ , d ′ ′ ) = 0 f(p'',d'') = 0 f ( p ′′ , d ′′ ) = 0 . Observe that d f ( p ) = f ( d ′ , p ′ ) d_f(p) = f(d',p') d f ( p ) = f ( d ′ , p ′ ) . In this case, by Property 1(iii), f ( p ′ , t ) = ℓ ( p ) f(p',t) = \ell(p) f ( p ′ , t ) = ℓ ( p ) . Since f ( p ′ ′ , d ′ ′ ) = 0 f(p'',d'') = 0 f ( p ′′ , d ′′ ) = 0 , ∣ M ( p ) ∣ = ℓ ( p ) − f ( d ′ , p ′ ) |M(p)| = \ell(p) - f(d',p') ∣ M ( p ) ∣ = ℓ ( p ) − f ( d ′ , p ′ ) . This implies that d M ( p ) = f ( d ′ , p ′ ) = d f ( p ) d_M(p) = f(d',p') = d_f(p) d M ( p ) = f ( d ′ , p ′ ) = d f ( p ) .
Thus, for every post, the deviation with respect to a good flow and the deviation with respect to the corresponding matching are the same. This immediately implies that the total deviation of a good flow and that of the corresponding matching are the same.
It is not immediate how to compute a good flow in a flow network. However, given a feasible flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) , we show that it is possible to construct a good flow in a different flow network. We need the following notation. For an edge ( a , p ) (a,p) ( a , p ) in G G G , we call the path ⟨ s , a , p ′ , t ⟩ \langle s,a,p',t\rangle ⟨ s , a , p ′ , t ⟩ in the network the true path , and the path ⟨ s , a , p ′ ′ , d ′ ′ , t ⟩ \langle s,a,p'',d'',t\rangle ⟨ s , a , p ′′ , d ′′ , t ⟩ the extended path . For a post p p p in G G G , we call the path ⟨ s , d ′ , p ′ , t ⟩ \langle s,d',p',t\rangle ⟨ s , d ′ , p ′ , t ⟩ the dummy path . Note that, corresponding to an applicant a a a and a post p p p in G G G , we have a true path and an extended path, and using either one of them, we can route a maximum of 1 unit of flow in the network. Corresponding to a post p p p in G G G , we have a unique dummy path, and the maximum flow that can be routed along this path is min { l d , u ( p ) } \min\{l_d,u(p)\} min { l d , u ( p )} . Let f f f be a feasible flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) . We say that the status of a post p ∈ P p \in\mathcal{P} p ∈ P is good with respect to f f f if the corresponding pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ in the network satisfies the conditions given in Property 1; otherwise, the status of p p p is bad with respect to the flow f f f .
Suppose we have a bad post p p p in G G G with respect to the flow f f f . We reroute the flow in a certain way to turn the post p p p into a good post without changing the status of any other post. We now describe the different cases under which p p p can be a bad post and the rerouting required to turn it into a good post.
Definition 7 (correcting flow). Let f f f be a feasible flow in the network H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) that has a bad post p p p with respect to f f f , and let f ′ f' f ′ be another flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) that differs only in the flow across some of the s s s -t t t paths corresponding to the post p p p . Then f ′ f' f ′ is called a correcting flow for f f f if it satisfies the following conditions.
(i) There exists a network H ( l d ′ , u d ′ ) H_{(l_{d'},u_{d'})} H ( l d ′ , u d ′ ) such that f ′ f' f ′ is feasible in the network H ( l d ′ , u d ′ ) H_{(l_{d'},u_{d'})} H ( l d ′ , u d ′ ) , where l d ′ + u d ′ < l d + u d l_{d'} + u_{d'} < l_d + u_d l d ′ + u d ′ < l d + u d .
(ii) The matchings corresponding to f f f and f ′ f' f ′ are the same.
(iii) Status of any post q ∈ P ∖ { p } q \in\mathcal{P} \setminus\{p\} q ∈ P ∖ { p } remains the same in f f f and f ′ f' f ′ .
We describe the types of a correcting flow f ′ f' f ′ .
( l d , u d ) (l_d,u_d) ( l d , u d ) -correcting flow. Assume that the post p p p violates Property 1 ( i ) 1(i) 1 ( i ) . Thus, f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 and f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 . We reduce the flow along the dummy path corresponding to p p p by 1. Following this, we select an arbitrary extended path carrying unit flow corresponding to the post p p p , say ⟨ s , a , p ′ ′ , d ′ ′ , t ⟩ \langle s,a,p'',d'',t\rangle ⟨ s , a , p ′′ , d ′′ , t ⟩ and reroute the flow along the path ⟨ s , a , p ′ , t ⟩ \langle s,a,p',t\rangle ⟨ s , a , p ′ , t ⟩ . Note that the resulting flow f ′ f' f ′ is feasible in the network H ( l d ′ , u d ′ ) H_{(l_{d'},u_{d'})} H ( l d ′ , u d ′ ) , where l d ′ = l d − 1 l_{d'} = l_d - 1 l d ′ = l d − 1 and u d ′ = u d − 1 u_{d'} = u_d - 1 u d ′ = u d − 1 .
u d u_d u d -correcting flow. Assume that the post p p p violates Property 1 ( i i ) 1(ii) 1 ( ii ) . Thus, f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 and f ( p ′ , t ) < u ( p ) f(p',t) < u(p) f ( p ′ , t ) < u ( p ) . We select an arbitrary extended path carrying unit flow corresponding to the post p p p , say ⟨ s , a , p ′ ′ , d ′ ′ , t ⟩ \langle s,a,p'',d'',t\rangle ⟨ s , a , p ′′ , d ′′ , t ⟩ and reroute the flow along the path ⟨ s , a , p ′ , t ⟩ \langle s,a,p',t\rangle ⟨ s , a , p ′ , t ⟩ . Note that the resulting flow f ′ f' f ′ is feasible in a network H ( l d ′ , u d ′ ) H_{(l_{d'},u_{d'})} H ( l d ′ , u d ′ ) , where l d ′ = l d l_{d'} = l_d l d ′ = l d and u d ′ = u d − 1 u_{d'} = u_d - 1 u d ′ = u d − 1 .
l d l_d l d -correcting flow. Assume that p p p violates Property 1 ( i i i ) 1(iii) 1 ( iii ) . Thus, f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 and f ( p ′ , t ) > ℓ ( p ) f(p',t) > \ell(p) f ( p ′ , t ) > ℓ ( p ) . We reduce the flow along the dummy path corresponding to p p p by 1. Note that the resulting flow f ′ f' f ′ is feasible in a network H ( l d ′ , u d ′ ) H_{(l_{d'},u_{d'})} H ( l d ′ , u d ′ ) , where l d ′ = l d − 1 l_{d'} = l_d - 1 l d ′ = l d − 1 and u d ′ = u d u_{d'} = u_d u d ′ = u d .
Note that in each of the above cases, if applicant a a a is matched to the post p p p prior to the rerouting, then it continues to remain matched to p p p after the rerouting. Since we have not changed the flow with respect to any post q ∈ P ∖ { p } q \in\mathcal{P} \setminus\{p\} q ∈ P ∖ { p } , the status of the post q q q remains unchanged. Thus f ′ f' f ′ is a correcting flow. For illustration, the correcting flow for the scenario 1 is given in Figure 4 (ii).
Lemma 2. If f f f is a feasible flow in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) that does not satisfy Property 1 1 1 , then there exists a correcting flow f ∗ f^* f ∗ for f f f in H ( l d , u d ) H_{(l_d,u_d)} H ( l d , u d ) that satisfies Property 1 1 1 .
Proof: Let p p p be a bad post with respect to f f f . We apply a sequence of correcting flows to change the status of the post p p p from bad to good. Assume that the pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ corresponding to p p p violates Property 1 ( i ) 1(i) 1 ( i ) , and thus f ( d ′ , p ′ ) > 0 f(d',p') > 0 f ( d ′ , p ′ ) > 0 and f ( p ′ ′ , d ′ ′ ) > 0 f(p'',d'') > 0 f ( p ′′ , d ′′ ) > 0 . Let
x p = min { f ( d ′ , p ′ ) , f ( p ′ ′ , d ′ ′ ) } . x_p = \min\{f(d',p'), f(p'',d'')\}. x p = min { f ( d ′ , p ′ ) , f ( p ′′ , d ′′ )} .
We apply x p x_p x p many ( l d , u d ) (l_d,u_d) ( l d , u d ) -correcting flows. Let the resulting flow be f ′ f' f ′ . After the above changes, at least one of the edges ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) or ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) has a zero flow in f ′ f' f ′ . That is, the nodes p ′ p' p ′ and p ′ ′ p'' p ′′ satisfy Property 1 ( i ) 1(i) 1 ( i ) with respect to f ′ f' f ′ . However, the nodes p ′ p' p ′ and p ′ ′ p'' p ′′ may still violate either Property 1(ii) or Property 1(iii), but not both. Depending on which property is violated, we consider the following two cases.
Case 1: f ′ ( d ′ , p ′ ) > 0 f'(d',p')>0 f ′ ( d ′ , p ′ ) > 0 . In this case, because f ′ ( p ′ ′ , d ′ ′ ) = 0 f'(p'',d'')=0 f ′ ( p ′′ , d ′′ ) = 0 , the pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ trivially satisfies Property 1(ii). Now suppose f ′ ( d ′ , p ′ ) > 0 f'(d',p')>0 f ′ ( d ′ , p ′ ) > 0 and f ′ ( p ′ , t ) = u ( p ) > ℓ ( p ) f'(p',t)=u(p)>\ell(p) f ′ ( p ′ , t ) = u ( p ) > ℓ ( p ) , which implies that the pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ violates Property 1(iii). Let
y p = min { f ′ ( d ′ , p ′ ) , f ′ ( p ′ , t ) − ℓ ( p ) } . y_p=\min\{f'(d',p'),f'(p',t)-\ell(p)\}. y p = min { f ′ ( d ′ , p ′ ) , f ′ ( p ′ , t ) − ℓ ( p )} .
In this case, we apply y p y_p y p many l d ld l d -correcting flows.
Case 2: f ′ ( p ′ ′ , d ′ ′ ) > 0 f'(p'',d'')>0 f ′ ( p ′′ , d ′′ ) > 0 . In this case, because f ′ ( d ′ , p ′ ) = 0 f'(d',p')=0 f ′ ( d ′ , p ′ ) = 0 , the pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ trivially satisfies Property 1(iii). Now suppose f ′ ( p ′ ′ , d ′ ′ ) > 0 f'(p'',d'')>0 f ′ ( p ′′ , d ′′ ) > 0 and f ′ ( p ′ , t ) = ℓ ( p ) < u ( p ) f'(p',t)=\ell(p)<u(p) f ′ ( p ′ , t ) = ℓ ( p ) < u ( p ) , which implies that the pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ violates Property 1(ii). Let
z p = min { f ′ ( p ′ ′ , d ′ ′ ) , u ( p ) − f ′ ( p ′ , t ) } . z_p=\min\{f'(p'',d''),u(p)-f'(p',t)\}. z p = min { f ′ ( p ′′ , d ′′ ) , u ( p ) − f ′ ( p ′ , t )} .
In this case, we apply z p z_p z p many u d ud u d -correcting flows.
Let f ~ \tilde{f} f ~ be the resulting flow. Observe that the pair of nodes p ′ , p ′ ′ p',p'' p ′ , p ′′ satisfies all the conditions in Property 1, and thus the post p p p is a good post with respect to the flow f ~ \tilde{f} f ~ . Recall that, by applying correcting flows, the status of the other posts remains unchanged. Therefore, we can apply these corrections independently. For all the bad posts with respect to f f f , we apply a sequence of correcting flows as described above. Observe that the resulting flow f ∗ f^* f ∗ is a feasible flow that satisfies Property 1 in another network H ( l d ′ , u d ′ ) H(ld',ud') H ( l d ′ , u d ′ ) , where l d ′ + u d ′ < l d + u d ld'+ud'<ld+ud l d ′ + u d ′ < l d + u d . □
We are ready to design our flow network based algorithm, which employs linear search over a specific range to compute an optimal matching. For an optimal matching M ∗ M^* M ∗ in G G G , we have the following claims.
Claim 1. The total deviation of M ∗ M^* M ∗ is at least ∑ p ∈ P ℓ ( p ) − ∣ A ∣ \sum_{p\in\mathcal{P}}\ell(p)-|\mathcal{A}| ∑ p ∈ P ℓ ( p ) − ∣ A ∣ .
Proof: Let l d ∗ ld^* l d ∗ be the total lower deviation of the matching M ∗ M^* M ∗ . For every matched applicant, it may contribute to satisfying the lower target of one post. Thus, l d ∗ ≥ ∑ p ∈ P ℓ ( p ) − ∣ M ∗ ∣ ld^*\geq\sum_{p\in\mathcal{P}}\ell(p)-|M^*| l d ∗ ≥ ∑ p ∈ P ℓ ( p ) − ∣ M ∗ ∣ . Since the total deviation of M ∗ M^* M ∗ , d t o t ( M ∗ ) d_{\mathrm{tot}}(M^*) d tot ( M ∗ ) is at least l d ∗ ld^* l d ∗ , and ∣ M ∗ ∣ ≤ ∣ A ∣ |M^*|\leq|\mathcal{A}| ∣ M ∗ ∣ ≤ ∣ A ∣ , it is clear that d t o t ( M ∗ ) d_{\mathrm{tot}}(M^*) d tot ( M ∗ ) is at least ∑ p ∈ P ℓ ( p ) − ∣ A ∣ \sum_{p\in\mathcal{P}}\ell(p)-|\mathcal{A}| ∑ p ∈ P ℓ ( p ) − ∣ A ∣ . □
Claim 2. The total deviation of M ∗ M^* M ∗ is at most ∑ p ∈ P ℓ ( p ) + ∣ A ∣ \sum_{p\in\mathcal{P}}\ell(p)+|\mathcal{A}| ∑ p ∈ P ℓ ( p ) + ∣ A ∣ .
Proof: Observe that for any matching, the maximum value possible for upper deviation is ∣ A ∣ |\mathcal{A}| ∣ A ∣ , and the maximum possible value for lower deviation is ∑ p ∈ P ℓ ( p ) \sum_{p\in\mathcal{P}}\ell(p) ∑ p ∈ P ℓ ( p ) . Thus, the total deviation of M ∗ M^* M ∗ is at most ∑ p ∈ P ℓ ( p ) + ∣ A ∣ \sum_{p\in\mathcal{P}}\ell(p)+|\mathcal{A}| ∑ p ∈ P ℓ ( p ) + ∣ A ∣ . □
Thus, it is enough to search for the value of total deviation Δ \Delta Δ in the range [ max { 0 , ∑ p ∈ P ℓ ( p ) − ∣ A ∣ } , ∑ p ∈ P ℓ ( p ) + ∣ A ∣ ] \left[\max\left\{0,\sum_{p\in\mathcal{P}}\ell(p)-|\mathcal{A}|\right\},\sum_{p\in\mathcal{P}}\ell(p)+|\mathcal{A}|\right] [ max { 0 , ∑ p ∈ P ℓ ( p ) − ∣ A ∣ } , ∑ p ∈ P ℓ ( p ) + ∣ A ∣ ] . Note that, even if for a particular value of Δ \Delta Δ , and a split of Δ \Delta Δ as l d ld l d and u d ud u d , we find a feasible flow in H ( l d , u d ) H(ld,ud) H ( l d , u d ) , it is required to ensure that the signature of the corresponding matching satisfies the signature requirement. We now present the algorithm.
To compute RMM-SIGN-MIN-TOT, we use linear search to find the optimum value of Δ \Delta Δ . Note that, for a fixed value of Δ \Delta Δ , there are Δ + 1 \Delta+1 Δ + 1 ways to split the total deviation as sum of lower
Algorithm 1: Algorithm for RMM-SIGN-MIN-TOT
set l o w = max { 0 , ∑ p ∈ P ℓ ( p ) − ∣ A ∣ } \mathrm{low}=\max\{0,\sum_{p\in P}\ell(p)-|A|\} low = max { 0 , ∑ p ∈ P ℓ ( p ) − ∣ A ∣ } , h i g h = ∑ p ∈ P ℓ ( p ) + ∣ A ∣ \mathrm{high}=\sum_{p\in P}\ell(p)+|A| high = ∑ p ∈ P ℓ ( p ) + ∣ A ∣ , Δ = l o w \Delta=\mathrm{low} Δ = low
while Δ ≤ h i g h \Delta\le\mathrm{high} Δ ≤ high do
set f o u n d = 0 \mathrm{found}=0 found = 0
for each of the Δ + 1 \Delta+1 Δ + 1 ways to split Δ \Delta Δ as l d \mathrm{ld} ld and u d \mathrm{ud} ud where Δ = l d + u d \Delta=\mathrm{ld}+\mathrm{ud} Δ = ld + ud do
construct H ( l d , u d ) H_{(\mathrm{ld},\mathrm{ud})} H ( ld , ud )
if H ( l d , u d ) H_{(\mathrm{ld},\mathrm{ud})} H ( ld , ud ) admits a feasible flow then
compute a min-cost flow f f f and corresponding matching M M M
if σ ( M ) ⪰ R ρ \sigma(M)\succeq_R\rho σ ( M ) ⪰ R ρ then
set f o u n d = 1 \mathrm{found}=1 found = 1
if f o u n d = = 0 \mathrm{found}==0 found == 0 then
set Δ = Δ + 1 \Delta=\Delta+1 Δ = Δ + 1
else
return f ∗ = f f^*=f f ∗ = f and M ∗ = M M^*=M M ∗ = M
deviation l d \mathrm{ld} ld and upper deviation u d \mathrm{ud} ud . For each of these values, we construct the network H ( l d , u d ) H_{(\mathrm{ld},\mathrm{ud})} H ( ld , ud ) and compute a min-cost flow f f f in the network. Let M M M be the matching corresponding to the flow f f f . If M M M has a signature σ ( M ) ⪰ R ρ \sigma(M)\succeq_R\rho σ ( M ) ⪰ R ρ , then the optimal value of total deviation is at most Δ \Delta Δ . The pseudocode is presented as Algorithm 1.
Correctness of the Algorithm for RMM-SIGN-MIN-TOT. Given the lower and upper bound for the deviation of the optimal matching M ∗ M^* M ∗ , it is clear that a linear search over the range works. Now, we will show that, at Algorithm 1 of our algorithm, if σ ( M ) ≺ R ρ \sigma(M)\prec_R\rho σ ( M ) ≺ R ρ , then we can discard the split ( l d , u d ) (\mathrm{ld},\mathrm{ud}) ( ld , ud ) , and this is described in Claim 3.
Claim 3. If at Algorithm 1, σ ( M ) ≺ R ρ \sigma(M)\prec_R\rho σ ( M ) ≺ R ρ , then there does not exist any matching M ′ M' M ′ with total lower deviation l d \mathrm{ld} ld and total upper deviation u d \mathrm{ud} ud such that σ ( M ′ ) ⪰ R ρ \sigma(M')\succeq_R\rho σ ( M ′ ) ⪰ R ρ .
Proof. Note that any matching in G G G with a total lower deviation l d \mathrm{ld} ld and total upper deviation u d \mathrm{ud} ud has a feasible flow in the network H ( l d , u d ) H_{(\mathrm{ld},\mathrm{ud})} H ( ld , ud ) . In Algorithm 1 of our algorithm, we compute a matching M M M corresponding to a min-cost flow f f f in the network. By the cost assignment of E 2 E_2 E 2 edges in H ( l d , u d ) H_{(\mathrm{ld},\mathrm{ud})} H ( ld , ud ) , the matching M M M is a rank-maximal matching among all matchings with total lower deviation l d \mathrm{ld} ld and total upper deviation u d \mathrm{ud} ud . Thus if at Algorithm 1, σ ( M ) ≺ R ρ \sigma(M)\prec_R\rho σ ( M ) ≺ R ρ , then the signature of any matching with total lower deviation l d \mathrm{ld} ld and total upper deviation u d \mathrm{ud} ud is strictly less rank-maximal than the signature requirement ρ \rho ρ .
Now assume that our algorithm outputs a solution. Let Δ ∗ \Delta^* Δ ∗ be the value of Δ \Delta Δ for which our algorithm stops, and let l d ∗ \mathrm{ld}^* ld ∗ and u d ∗ \mathrm{ud}^* ud ∗ be the corresponding split for lower deviation and upper deviation, respectively. Our flow network H ( l d ∗ , u d ∗ ) H_{(\mathrm{ld}^*,\mathrm{ud}^*)} H ( ld ∗ , ud ∗ ) computes a min-cost flow, say f ∗ f^* f ∗ , which has a total deviation of Δ ∗ \Delta^* Δ ∗ . We have the following claim.
Claim 4. The flow f ∗ f^* f ∗ is a good flow in H ( l d ∗ , u d ∗ ) H_{(\mathrm{ld}^*,\mathrm{ud}^*)} H ( ld ∗ , ud ∗ ) .
Proof. If this is not the case, then f ∗ f^* f ∗ violates at least one of the conditions of Property 1. Corresponding to the violated condition, we have a correcting flow in H ( l d ∗ , u d ∗ ) H_{(\mathrm{ld}^*,\mathrm{ud}^*)} H ( ld ∗ , ud ∗ ) , and after applying it, we get a good flow f ′ f' f ′ in another network H ( l d ′ , u d ′ ) H_{(\mathrm{ld}',\mathrm{ud}')} H ( ld ′ , ud ′ ) , where l d ′ + u d ′ < l d ∗ + u d ∗ \mathrm{ld}'+\mathrm{ud}'<\mathrm{ld}^*+\mathrm{ud}^* ld ′ + ud ′ < ld ∗ + ud ∗ . Further, the matchings corresponding to f ∗ f^* f ∗ and f ′ f' f ′ are the same. This contradicts the fact that Δ ∗ \Delta^* Δ ∗ is the smallest value such that we obtain a matching satisfying the signature requirement.
Since f ∗ f^* f ∗ is a good flow in H ( l d ∗ , u d ∗ ) H_{(l d^*,u d^*)} H ( l d ∗ , u d ∗ ) , the corresponding matching M ∗ M^* M ∗ is an optimal solution to the RMM-SIGN-MIN-TOT problem.
Time complexity of Algorithm 1. For a flow network H = ( V H , E H ) H=(V_H,E_H) H = ( V H , E H ) , the running time required to compute a min-cost flow is T H = O ( ( ∣ E H ∣ log ∣ V H ∣ ) ( ∣ E H ∣ + ∣ V H ∣ log ∣ V H ∣ ) ) T_H=O((|E_H|\log|V_H|)(|E_H|+|V_H|\log|V_H|)) T H = O (( ∣ E H ∣ log ∣ V H ∣ ) ( ∣ E H ∣ + ∣ V H ∣ log ∣ V H ∣ )) using the enhanced capacity scaling algorithm [48 ] . Given an optimal total deviation value Δ ∗ \Delta^* Δ ∗ , the number of calls to the min-cost flow network H H H is Δ ∗ + 1 \Delta^*+1 Δ ∗ + 1 . To compute Δ ∗ \Delta^* Δ ∗ , we apply linear search within the range [ l o w , h i g h ] [\mathrm{low},\mathrm{high}] [ low , high ] , where l o w = max { 0 , ∑ p ∈ P ℓ ( p ) − ∣ A ∣ } \mathrm{low}=\max\{0,\sum_{p\in\mathcal{P}}\ell(p)-|\mathcal{A}|\} low = max { 0 , ∑ p ∈ P ℓ ( p ) − ∣ A ∣ } , and h i g h = ∑ p ∈ P ℓ ( p ) + ∣ A ∣ \mathrm{high}=\sum_{p\in\mathcal{P}}\ell(p)+|\mathcal{A}| high = ∑ p ∈ P ℓ ( p ) + ∣ A ∣ . Therefore, the time complexity of Algorithm 1 is O ( ( ( 2 ∣ A ∣ ) ( ∑ p ∈ P ℓ ( p ) + ∣ A ∣ + 1 ) ⋅ T H ) O(((2|\mathcal{A}|)(\sum_{p\in\mathcal{P}}\ell(p)+|\mathcal{A}|+1)\cdot T_H) O ((( 2∣ A ∣ ) ( ∑ p ∈ P ℓ ( p ) + ∣ A ∣ + 1 ) ⋅ T H ) . Note that the running time depends on the value of ℓ ( p ) \ell(p) ℓ ( p ) . For a post p p p with ℓ ( p ) > ∣ A ∣ \ell(p)>|\mathcal{A}| ℓ ( p ) > ∣ A ∣ , we can preprocess and adjust its ℓ ( p ) \ell(p) ℓ ( p ) value before applying Algorithm 1 to the modified network. The minimum total deviation value in the modified network can be translated back to the original network, thereby eliminating dependency on the term ∑ p ∈ P ℓ ( p ) \sum_{p\in\mathcal{P}}\ell(p) ∑ p ∈ P ℓ ( p ) . This ensures that the time complexity of our Algorithm 1 is polynomial in the size of the network. In the remaining sections of the paper, we assume that for any post p ∈ P p\in\mathcal{P} p ∈ P , ℓ ( p ) ≤ ∣ A ∣ \ell(p)\le|\mathcal{A}| ℓ ( p ) ≤ ∣ A ∣ .
Illustration of algorithm for RMM-SIGN-MIN-TOT. Given the instance G G G in Figure 1 and an input signature ( 4 , 0 , 0 , 3 ) (4,0,0,3) ( 4 , 0 , 0 , 3 ) , we perform linear search over the range [ l o w , h i g h ] [\mathrm{low},\mathrm{high}] [ low , high ] , where l o w = 0 \mathrm{low}=0 low = 0 , and h i g h = 12 \mathrm{high}=12 high = 12 . For Δ = 0 \Delta=0 Δ = 0 and Δ = 1 \Delta=1 Δ = 1 , the network constructed in Algorithm 1 of Algorithm 1 does not admit any feasible flow. For Δ = 3 \Delta=3 Δ = 3 , none of the splits gives a feasible solution. Although, corresponding to the splits ( 2 , 1 ) (2,1) ( 2 , 1 ) and ( 3 , 0 ) (3,0) ( 3 , 0 ) , the network admits feasible flows, their corresponding matchings fail to meet the signature requirement.
For Δ = 4 \Delta=4 Δ = 4 , we construct the network H ( l d , u d ) H_{(l d,u d)} H ( l d , u d ) for each ( l d , u d ) (l d,u d) ( l d , u d ) pair such that l d + u d = 4 l d+u d=4 l d + u d = 4 . For the network H ( 2 , 2 ) H_{(2,2)} H ( 2 , 2 ) , consider the flow f f f defined below. For the pairs ( a 1 , p 1 ) (a_1,p_1) ( a 1 , p 1 ) , ( a 3 , p 2 ) (a_3,p_2) ( a 3 , p 2 ) , ( a 4 , p 7 ) (a_4,p_7) ( a 4 , p 7 ) , ( a 5 , p 4 ) (a_5,p_4) ( a 5 , p 4 ) , and ( a 6 , p 6 ) (a_6,p_6) ( a 6 , p 6 ) , the flow f f f routes 1 unit of flow through the corresponding true path (⟨ s , a , p ′ , t ⟩ \langle s,a,p',t\rangle ⟨ s , a , p ′ , t ⟩ path). It also routes 1 unit of flow along extended paths for pairs ( a 2 , p 1 ) (a_2,p_1) ( a 2 , p 1 ) and ( a 7 , p 1 ) (a_7,p_1) ( a 7 , p 1 ) , and along dummy paths for posts p 3 p_3 p 3 and p 5 p_5 p 5 .
Observe that f f f is a min-cost feasible flow in H ( 2 , 2 ) H_{(2,2)} H ( 2 , 2 ) and satisfies Property 1. Corresponding to the flow f f f , we have a matching M 3 M_3 M 3 listed in Table 1 . Since σ ( M 3 ) ⪰ R ( 4 , 0 , 0 , 3 ) \sigma(M_3)\succeq_{\mathcal{R}}(4,0,0,3) σ ( M 3 ) ⪰ R ( 4 , 0 , 0 , 3 ) , the matching is a feasible solution for the problem RMM-SIGN-MIN-TOT. It is easy to verify that any matching that meets the signature requirement has a total deviation of at least 4, and thus the matching M 3 M_3 M 3 is an optimal solution for the RMM-SIGN-MIN-TOT problem.
Modification for Fairness
For solving the problem FAIR-SIGN-MIN-TOT, we construct the same network H ( l d , u d ) H_{(l d,u d)} H ( l d , u d ) as in Figure 3 , where l d + u d = Δ l d+u d=\Delta l d + u d = Δ . The network H ( l d , u d ) H_{(l d,u d)} H ( l d , u d ) for FAIR-SIGN-MIN-TOT differs from that of RMM-SIGN-MIN-TOT in the assignment of cost of the edges in E 2 \mathcal{E}_2 E 2 .
For an edge ( a , p ′ ) (a,p') ( a , p ′ ) or ( a , p ′ ′ ) (a,p'') ( a , p ′′ ) in E 2 \mathcal{E}_2 E 2 , if the corresponding edge ( a , p ) (a,p) ( a , p ) in G G G is of rank i i i , then we set cost of that edge as ( n + 1 ) i (n+1)^i ( n + 1 ) i .
We have the following lemma regarding the above cost assignment.
Lemma 3. Let M , M ′ M,M' M , M ′ be matchings such that σ ( M ) ≻ F σ ( M ′ ) \sigma(M)\succ_{\mathcal{F}}\sigma(M') σ ( M ) ≻ F σ ( M ′ ) . Then, c o s t ( M ) < c o s t ( M ′ ) cost(M)<cost(M') cos t ( M ) < cos t ( M ′ ) , where each rank i i i edge has a cost of ( n + 1 ) i (n+1)^i ( n + 1 ) i , and every unmatched applicant is treated as being matched to a dummy post of rank r + 1 r+1 r + 1 with cost ( n + 1 ) r + 1 (n+1)^{r+1} ( n + 1 ) r + 1 .
Note that our algorithm and proofs can be easily modified with respect to the notion of fairness.
Minimizing Total Deviation: Deviation First
In this section, we present the results for minimizing total deviation for the deviation first, preference optimality next type of problems.
Algorithm for RMM-MIN-TOT
Given an instance of the soft quota setting, our goal is to compute a matching that is rank-maximal among all matchings that have a minimum value of total deviation. First, we consider the simpler problem of computing a minimum total deviation matching in G G G ignoring applicant preferences.
Given an instance G G G of the soft quota setting, we denote the same instance viewed as an instance of the fixed quota setting by G x G_x G x . Recall that in the fixed quota setting, for a post p p p , we have a fixed lower quota q − ( p ) q^{-}(p) q − ( p ) and a fixed upper quota q + ( p ) q^{+}(p) q + ( p ) associated with it. A matching M M M is feasible in the fixed quota setting if, for every post p ∈ P p \in\mathcal{P} p ∈ P , q − ( p ) ≤ ∣ M ( p ) ∣ ≤ q + ( p ) q^{-}(p) \leq|M(p)| \leq q^{+}(p) q − ( p ) ≤ ∣ M ( p ) ∣ ≤ q + ( p ) . We note that with respect to the problem of minimizing total deviation, there is a useful connection between matchings in G G G and G x G_x G x . If the fixed quota setting instance G x G_x G x admits a feasible matching M M M , then M M M has a total deviation of 0 in the soft quota setting instance G G G . Thus, M M M is an optimal matching in G G G as far as deviation is concerned. However, if G x G_x G x does not admit a feasible matching, any minimum total deviation matching in G G G has a positive value for the total deviation.
We observe that in an optimal matching M ∗ M^* M ∗ in G G G , no post incurs a violation on the upper target. To see this, suppose that for a post p p p , we have more than u ( p ) u(p) u ( p ) applicants matched to it in M ∗ M^* M ∗ . Then, we can remove the excess number of applicants, namely ∣ M ∗ ( p ) ∣ − u ( p ) |M^*(p)| - u(p) ∣ M ∗ ( p ) ∣ − u ( p ) , matched to p p p from M ∗ M^* M ∗ and obtain a matching with a smaller value of total deviation. We use the above observation and the connection between G G G and G x G_x G x to compute a matching with minimum total deviation without applicant preferences.
Minimizing total deviation. Given the instance G G G , we construct an instance G ′ G' G ′ of the soft quota setting, where for every post p p p , ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) \ell'(p) = u'(p) = \ell(p) ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) . Consider the fixed quota setting instance G x ′ G'_x G x ′ , where we set q − ( p ) = 0 q^{-}(p) = 0 q − ( p ) = 0 and q + ( p ) = ℓ ( p ) q^{+}(p) = \ell(p) q + ( p ) = ℓ ( p ) for every post p p p . We show a connection between a maximum matching in G x ′ G'_x G x ′ and a minimum total deviation matching in G ′ G' G ′ , as stated in Lemma 4.
Lemma 4. Any maximum matching in G x ′ G'_x G x ′ is a minimum total deviation matching in G ′ G' G ′ .
Proof: Let M ′ M' M ′ be an arbitrary maximum matching in G x ′ G'_x G x ′ . Using the maximality of M ′ M' M ′ in the instance G x ′ G'_x G x ′ , we show that M ′ M' M ′ is a minimum total deviation matching in G ′ G' G ′ . Suppose not. Let M M M be a minimum total deviation matching in G ′ G' G ′ . That is, d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) in G ′ G' G ′ is less than d t o t ( M ′ ) d_{\mathrm{tot}}(M') d tot ( M ′ ) in G ′ G' G ′ . Since M M M is an optimal matching in G ′ G' G ′ , for every post p p p , ∣ M ( p ) ∣ ≤ ℓ ( p ) |M(p)| \leq\ell(p) ∣ M ( p ) ∣ ≤ ℓ ( p ) , and thus it is a valid matching in G x ′ G'_x G x ′ . Now we compare the cardinalities of M M M and M ′ M' M ′ . Since u ′ ( p ) = ℓ ( p ) u'(p) = \ell(p) u ′ ( p ) = ℓ ( p ) for every post p p p , ∣ M ∣ = ∑ p ∈ P ℓ ( p ) − d t o t ( M ) |M| = \sum_{p \in\mathcal{P}} \ell(p) - d_{\mathrm{tot}}(M) ∣ M ∣ = ∑ p ∈ P ℓ ( p ) − d tot ( M ) , and ∣ M ′ ∣ = ∑ p ∈ P ℓ ( p ) − d t o t ( M ′ ) |M'| = \sum_{p \in\mathcal{P}} \ell(p) - d_{\mathrm{tot}}(M') ∣ M ′ ∣ = ∑ p ∈ P ℓ ( p ) − d tot ( M ′ ) . This implies that ∣ M ∣ > ∣ M ′ ∣ |M| > |M'| ∣ M ∣ > ∣ M ′ ∣ , which is a contradiction to the fact that M ′ M' M ′ is a maximum matching in G x ′ G'_x G x ′ .
Now we establish an interesting connection between the minimum value of total deviation in the soft quota instance G ′ G' G ′ and that of the original soft quota setting instance G G G , as stated in Lemma 5.
Lemma 5. The minimum value of total deviation of G ′ G' G ′ and G G G are the same.
Proof: Let k ′ k' k ′ be the total deviation of a minimum total deviation matching in G ′ G' G ′ . Note that k ′ k' k ′ is the sum of the lower deviations of all posts in G ′ G' G ′ . Since G ′ ⊆ G G' \subseteq G G ′ ⊆ G , the minimum value of the total deviation in G G G , denoted by k k k , satisfies k ≤ k ′ k \le k' k ≤ k ′ . Suppose that k < k ′ k < k' k < k ′ . Let M M M be a matching that achieves the minimum value of total deviation in G G G . Note that k k k is the sum of lower deviations of all posts in G G G .
In the soft quota setting instance G ′ G' G ′ , with respect to the matching M M M , some posts may incur violation on the upper target. This is because, in G ′ G' G ′ , the upper target of a post p p p is u ′ ( p ) = ℓ ( p ) u'(p) = \ell(p) u ′ ( p ) = ℓ ( p ) which is at most the corresponding upper target u ( p ) u(p) u ( p ) in G G G . Now we construct the matching M ′ M' M ′ in G ′ G' G ′ , where for every post p p p , we remove max { 0 , ∣ M ( p ) ∣ − ℓ ( p ) } \max\{0, |M(p)| - \ell(p)\} max { 0 , ∣ M ( p ) ∣ − ℓ ( p )} number of applicants which are matched to p p p . Note that in G ′ G' G ′ , with respect to the matching M ′ M' M ′ , no post incurs a violation on the upper target. Thus, the total deviation of the matching M ′ M' M ′ in G ′ G' G ′ is k k k , which is the total deviation of M M M in G G G . This contradicts the fact that k ′ k' k ′ is the minimum value of total deviation in G ′ G' G ′ .
By Lemma 4 and Lemma 5, any maximum matching M ′ M' M ′ in G x ′ G'_x G x ′ is also a minimum total deviation matching in the original soft quota setting instance G G G . However, M ′ M' M ′ need not be a maximum matching among all matchings with minimum value of total deviation in G G G . To obtain such a matching, we use the instance G x G_x G x (recall that every post p p p in G x G_x G x has q + ( p ) = u ( p ) q^+(p) = u(p) q + ( p ) = u ( p ) ) and augment the matching M ′ M' M ′ in G x G_x G x . We remark that augmenting a matching never decreases the number of applicants matched to any post. Thus, augmenting M ′ M' M ′ in G x G_x G x increases the size of the matching while preserving its total deviation.
For an illustration, consider the soft quota instance G G G given in Figure 1 . We construct the soft quota instance G ′ G' G ′ , and let G x ′ G'_x G x ′ be the corresponding fixed quota instance. Consider the maximum matching M ′ = { ( a 1 , p 1 ) , ( a 3 , p 3 ) , ( a 5 , p 5 ) } M' = \{(a_1,p_1),(a_3,p_3),(a_5,p_5)\} M ′ = {( a 1 , p 1 ) , ( a 3 , p 3 ) , ( a 5 , p 5 )} in G x ′ G'_x G x ′ . We augment the matching M ′ M' M ′ in G x G_x G x to obtain a matching M = { ( a 1 , p 1 ) , ( a 3 , p 3 ) , ( a 5 , p 5 ) , ( a 6 , p 7 ) , ( a 7 , p 6 ) } M = \{(a_1,p_1),(a_3,p_3),(a_5,p_5),(a_6,p_7),(a_7,p_6)\} M = {( a 1 , p 1 ) , ( a 3 , p 3 ) , ( a 5 , p 5 ) , ( a 6 , p 7 ) , ( a 7 , p 6 )} . Note that M M M is a maximum matching in G x G_x G x , and it has a total deviation of 2 2 2 in G G G , which is the optimum value of total deviation.
Since we disregarded preferences, the above procedure does not guarantee a matching that is optimal with respect to the preferences. For example, the matching M M M computed above is not a solution of RMM-MIN-TOT problem in G G G , since the matching M 1 M_1 M 1 (illustrated in Table 1 ) is more rank-maximal than M M M . In the rest of the section, we refine the above ideas to compute an RMM-MIN-TOT matching in G G G .
We construct the instance G ′ G' G ′ from G G G as discussed above. We compute an RMM-MIN-TOT matching M M M in G ′ G' G ′ using the procedure given in Step (A) below.
We augment the matching M M M in G x G_x G x to obtain an RMM-MIN-TOT matching M ∗ M^* M ∗ in G G G . The procedure for computing M ∗ M^* M ∗ is given in Step (B).
Step (A): Computing RMM-MIN-TOT in G ′ G' G ′ . Given the instance G ′ G' G ′ , we reduce the problem to computing a min-cost flow in a suitably designed flow network H H H . We show that a matching M M M corresponding to a min-cost flow in H H H has the following properties:
M M M is a minimum total deviation matching in G ′ G' G ′ and also in G G G .
M M M is a rank-maximal matching among all minimum total deviation matchings in G ′ G' G ′ . Note that M M M need not be a solution to RMM-MIN-TOT in G G G .
We construct the flow network H H H as follows. For every post p p p , we introduce ℓ ( p ) \ell(p) ℓ ( p ) many dummy applicants and denote this set by D p \mathcal{D}_p D p . Let D = ⋃ p ∈ P D p \mathcal{D} = \bigcup_{p\in\mathcal{P}} \mathcal{D}_p D = ⋃ p ∈ P D p . The vertex set of H H H is defined as below:
V ( H ) = { s , t } ∪ ( A ∪ D ) ∪ P . V(H) = \{s,t\} \cup(\mathcal{A} \cup\mathcal{D}) \cup\mathcal{P}. V ( H ) = { s , t } ∪ ( A ∪ D ) ∪ P .
The edge set E ( H ) E(H) E ( H ) is the union of the following sets:
E s A = { ( s , a ) : a ∈ A } \mathcal{E}_{sA}=\{(s,a):a\in\mathcal{A}\} E s A = {( s , a ) : a ∈ A }
E s D = { ( s , d ) : d ∈ D p , p ∈ P } \mathcal{E}_{sD}=\{(s,d):d\in\mathcal{D}_p,p\in\mathcal{P}\} E sD = {( s , d ) : d ∈ D p , p ∈ P }
E A P = { ( a , p ) : a ∈ A , p ∈ P } \mathcal{E}_{AP}=\{(a,p):a\in\mathcal{A},p\in\mathcal{P}\} E A P = {( a , p ) : a ∈ A , p ∈ P }
E D P = { ( d , p ) : d ∈ D p , p ∈ P } \mathcal{E}_{DP}=\{(d,p):d\in\mathcal{D}_p,p\in\mathcal{P}\} E D P = {( d , p ) : d ∈ D p , p ∈ P }
E P t = { ( p , t ) : p ∈ P } \mathcal{E}_{Pt}=\{(p,t):p\in\mathcal{P}\} E P t = {( p , t ) : p ∈ P }
Cost of the edges in H H H . For an edge ( a , p ) (a,p) ( a , p ) in G ′ G' G ′ having rank i i i , we set cost of the corresponding edge in E A P \mathcal{E}_{AP} E A P as − ( ( n + 1 ) r + ( n + 1 ) r − i ) -((n+1)^r+(n+1)^{r-i}) − (( n + 1 ) r + ( n + 1 ) r − i ) . For all the other edges in H H H , we set the cost as 0.
Capacity of the edges in H H H . For an edge ( p , t ) (p,t) ( p , t ) in E P t \mathcal{E}_{Pt} E P t , we set its capacity as ℓ ( p ) \ell(p) ℓ ( p ) . All other edges in H H H have a unit capacity.
Consider the cut { t , V ( H ) ∖ { t } } \{t,V(H)\setminus\{t\}\} { t , V ( H ) ∖ { t }} , and observe that the capacity of this cut is ∑ p ∈ P ℓ ( p ) \sum_{p\in\mathcal{P}}\ell(p) ∑ p ∈ P ℓ ( p ) . Thus, by max-flow min-cut theorem, the value of any flow is at most ∑ p ∈ P ℓ ( p ) \sum_{p\in\mathcal{P}}\ell(p) ∑ p ∈ P ℓ ( p ) . Note that for every post p p p , we can send 1 unit of flow via the path ⟨ s , d , p , t ⟩ \langle s,d,p,t\rangle ⟨ s , d , p , t ⟩ , where d ∈ D p d\in\mathcal{D}_p d ∈ D p , which implies that the value of a max-flow is at least ∑ p ∈ P ℓ ( p ) \sum_{p\in\mathcal{P}}\ell(p) ∑ p ∈ P ℓ ( p ) . Thus, any max-flow in H H H has a value of ∑ p ∈ P ℓ ( p ) \sum_{p\in\mathcal{P}}\ell(p) ∑ p ∈ P ℓ ( p ) . We define the deviation of a max-flow f f f in H H H as follows.
Definition 8 (Total deviation of a max-flow). The total deviation of a max-flow f f f in H H H is defined as
d t o t ( f ) = ∑ p ∈ P d f ( p ) d_{\mathrm{tot}}(f)=\sum_{p\in\mathcal{P}}d_f(p) d tot ( f ) = p ∈ P ∑ d f ( p ) where
d f ( p ) = ∑ d ∈ D p f ( d , p ) d_f(p)=\sum_{d\in\mathcal{D}_p}f(d,p) d f ( p ) = d ∈ D p ∑ f ( d , p ) is the incoming flow to the vertex p p p through the dummy applicants.
There is a natural correspondence between a flow f f f in H H H and a matching M M M in G ′ G' G ′ as follows:
M f = { ( a , p ) ∣ f ( a , p ) = 1 , ( a , p ) ∈ E A P } . M_f=\{(a,p)\mid f(a,p)=1,\ (a,p)\in\mathcal{E}_{AP}\}. M f = {( a , p ) ∣ f ( a , p ) = 1 , ( a , p ) ∈ E A P } .
Cost of a max-flow in H H H and total deviation of a matching in G ′ G' G ′ . For a max-flow f f f in H H H , we define the total cost of the flow, denoted by c o s t ( f ) cost(f) cos t ( f ) , as follows:
c o s t ( f ) = ∑ e ∈ E ( H ) f ( e ) ⋅ c ( e ) cost(f)=\sum_{e\in E(H)}f(e)\cdot c(e) cos t ( f ) = e ∈ E ( H ) ∑ f ( e ) ⋅ c ( e )
where f ( e ) f(e) f ( e ) and c ( e ) c(e) c ( e ) represent the flow and the cost on the edge e e e , respectively. By the design of our network H H H , we ensure that the cost of a max-flow in H H H corresponds to the total deviation of the corresponding matching in G ′ G' G ′ . This is proved using Lemma 6.
Lemma 6. Let f , f ′ f,f' f , f ′ be two flows in H H H , and let M f , M f ′ M_f,M_{f'} M f , M f ′ be the corresponding matchings in G ′ G' G ′ . If ∣ M f ∣ > ∣ M f ′ ∣ |M_f|>|M_{f'}| ∣ M f ∣ > ∣ M f ′ ∣ , then c o s t ( f ) < c o s t ( f ′ ) cost(f)<cost(f') cos t ( f ) < cos t ( f ′ ) .
Proof. For a post p p p , the incoming flow is via edges in E D P \mathcal{E}_{DP} E D P , and E A P \mathcal{E}_{AP} E A P . In H H H , only the edges in E A P \mathcal{E}_{AP} E A P have a non-zero cost, and recall the cost of an edge in E A P \mathcal{E}_{AP} E A P . Observe that cost of the flow f f f can be upper bounded by
c o s t ( f ) ≤ ∣ M f ∣ ( − ( n + 1 ) r ) − ∣ M f ∣ cost(f)\leq|M_f|\left(-(n+1)^r\right)-|M_f| cos t ( f ) ≤ ∣ M f ∣ ( − ( n + 1 ) r ) − ∣ M f ∣
where the equality is achieved when all edges are of rank r r r . Similarly, the cost of the flow f ′ f' f ′ can be lower bounded by
c o s t ( f ′ ) ≥ ∣ M f ′ ∣ ( − ( n + 1 ) r ) − ∣ M f ′ ∣ ( ( n + 1 ) r − 1 ) cost(f') \ge|M_{f'}|\left(-(n+1)^r\right)-|M_{f'}|\left((n+1)^{r-1}\right) cos t ( f ′ ) ≥ ∣ M f ′ ∣ ( − ( n + 1 ) r ) − ∣ M f ′ ∣ ( ( n + 1 ) r − 1 )
and the equality is achieved when all edges are of rank 1. To show that c o s t ( f ) < c o s t ( f ′ ) cost(f) < cost(f') cos t ( f ) < cos t ( f ′ ) , we show the equivalent statement
∣ M f ∣ ( ( n + 1 ) r ) + ∣ M f ∣ > ∣ M f ′ ∣ ( ( n + 1 ) r ) + ∣ M f ′ ∣ ( ( n + 1 ) r − 1 ) . |M_f|\left((n+1)^r\right)+|M_f|>|M_{f'}|\left((n+1)^r\right)+|M_{f'}|\left((n+1)^{r-1}\right). ∣ M f ∣ ( ( n + 1 ) r ) + ∣ M f ∣ > ∣ M f ′ ∣ ( ( n + 1 ) r ) + ∣ M f ′ ∣ ( ( n + 1 ) r − 1 ) .
Since ∣ M f ∣ − ∣ M f ′ ∣ ≥ 1 |M_f|-|M_{f'}|\ge1 ∣ M f ∣ − ∣ M f ′ ∣ ≥ 1 and ∣ M f ′ ∣ ≤ n |M_{f'}|\le n ∣ M f ′ ∣ ≤ n ,
( ∣ M f ∣ − ∣ M f ′ ∣ ) ( n + 1 ) r + ∣ M f ∣ − ∣ M f ′ ∣ ( n + 1 ) r − 1 ≥ ( n + 1 ) r + ∣ M f ∣ − n ( n + 1 ) r − 1 = ( n + 1 ) r − 1 + ∣ M f ∣ > 0. \begin{aligned}
\left(|M_f|-|M_{f'}|\right)(n+1)^r+|M_f|-|M_{f'}|(n+1)^{r-1}\ge(n+1)^r+|M_f|-n(n+1)^{r-1} \\
&= (n+1)^{r-1}+|M_f|>0.
\end{aligned} ( ∣ M f ∣ − ∣ M f ′ ∣ ) ( n + 1 ) r + ∣ M f ∣ − ∣ M f ′ ∣ ( n + 1 ) r − 1 ≥ ( n + 1 ) r + ∣ M f ∣ − n ( n + 1 ) r − 1 = ( n + 1 ) r − 1 + ∣ M f ∣ > 0.
Thus, c o s t ( f ) < c o s t ( f ′ ) cost(f)<cost(f') cos t ( f ) < cos t ( f ′ ) .
Lemma 7. Let f f f be a min-cost flow in H H H and let M f M_f M f be the corresponding matching in G ′ G' G ′ . Then M f M_f M f is a minimum total deviation matching in G ′ G' G ′ .
Proof. Suppose not, let M ∗ M^* M ∗ be a minimum total deviation matching in G ′ G' G ′ , and let f ∗ f^* f ∗ be the corresponding flow. Recall that in G ′ G' G ′ , every post p p p has ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) \ell'(p)=u'(p)=\ell(p) ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) , and thus M ∗ M^* M ∗ is a maximum cardinality matching. Since ∣ M ∗ ∣ > ∣ M f ∣ |M^*|>|M_f| ∣ M ∗ ∣ > ∣ M f ∣ , by Lemma 6, we have c o s t ( f ∗ ) < c o s t ( f ) cost(f^*)<cost(f) cos t ( f ∗ ) < cos t ( f ) , which is a contradiction.
Given the connection between the total deviations of G G G and G ′ G' G ′ established in Lemma 5, which is independent of the preferences, we know that the minimum total deviation in G G G is equal to that in G ′ G' G ′ . This leads to the following corollary.
Corollary 1. Any min-cost flow in H H H corresponds to a minimum total deviation matching in G G G .
We now prove the preference optimality of the matching obtained in Step (A).
Lemma 8. Any min-cost flow in H H H corresponds to a solution to RMM-MIN-TOT in G ′ G' G ′ .
Proof. Let f f f be a min-cost flow in H H H , and let M f M_f M f be the corresponding matching in G ′ G' G ′ . By Corollary 1, M f M_f M f is a minimum total deviation matching in G ′ G' G ′ . Suppose M f M_f M f is not an RMM-MIN-TOT matching in G ′ G' G ′ . Then there exists another matching M f ′ M_{f'} M f ′ that is an RMM-MIN-TOT matching in G ′ G' G ′ , and let f ′ f' f ′ be the corresponding flow in H H H . Since M f ′ M_{f'} M f ′ is a minimum total deviation matching, ∣ M f ∣ = ∣ M f ′ ∣ |M_f|=|M_{f'}| ∣ M f ∣ = ∣ M f ′ ∣ .
Since σ ( M f ′ ) ≻ R σ ( M f ) \sigma(M_{f'})\succ_R\sigma(M_f) σ ( M f ′ ) ≻ R σ ( M f ) , by the definition of rank-maximality, there exists an index i i i such that σ ( M f ′ ) j ≻ R σ ( M f ) j \sigma(M_{f'})_j\succ_R\sigma(M_f)_j σ ( M f ′ ) j ≻ R σ ( M f ) j and σ ( M f ′ ) j = σ ( M f ) j \sigma(M_{f'})_j=\sigma(M_f)_j σ ( M f ′ ) j = σ ( M f ) j for j < i j<i j < i . Recall that, corresponding to a rank i i i edge in G ′ G' G ′ , we have an edge in E \mathcal{E} E with a cost of − ( n + 1 ) r + ( n + 1 ) r − i -(n+1)^r+(n+1)^{r-i} − ( n + 1 ) r + ( n + 1 ) r − i in H H H .
Since ∣ M f ∣ = ∣ M f ′ ∣ |M_f|=|M_{f'}| ∣ M f ∣ = ∣ M f ′ ∣ , both flows have the same contribution from the term − ( n + 1 ) r -(n+1)^r − ( n + 1 ) r . By Lemma 1, the rank-dependent contribution to c o s t ( f ′ ) cost(f') cos t ( f ′ ) is smaller than that of c o s t ( f ) cost(f) cos t ( f ) . Thus, c o s t ( f ′ ) < c o s t ( f ) cost(f')<cost(f) cos t ( f ′ ) < cos t ( f ) , which is a contradiction.
We observe that every minimum total deviation matching in G G G has cardinality of at least ∣ M ∣ |M| ∣ M ∣ .
Lemma 9. Let N N N be a matching in G G G such that d t o t ( N ) = d t o t ( M ) d_{\mathrm{tot}}(N)=d_{\mathrm{tot}}(M) d tot ( N ) = d tot ( M ) . Then ∣ N ∣ ≥ ∣ M ∣ |N|\ge|M| ∣ N ∣ ≥ ∣ M ∣ .
Proof: Since M M M is a maximum matching in the restricted instance G ′ G' G ′ , we have d t o t ( M ) = ∑ p ∈ P ℓ ( p ) − ∣ M ∣ d_{\mathrm{tot}}(M)=\sum_{p\in P}\ell(p)-|M| d tot ( M ) = ∑ p ∈ P ℓ ( p ) − ∣ M ∣ . Now let N N N be a matching in G G G . Observe that d t o t ( N ) ≥ ∑ p ∈ P ℓ ( p ) − ∣ N ∣ d_{\mathrm{tot}}(N)\ge\sum_{p\in P}\ell(p)-|N| d tot ( N ) ≥ ∑ p ∈ P ℓ ( p ) − ∣ N ∣ . Since d t o t ( N ) = d t o t ( M ) d_{\mathrm{tot}}(N)=d_{\mathrm{tot}}(M) d tot ( N ) = d tot ( M ) , we obtain ∑ p ∈ P ℓ ( p ) − ∣ M ∣ ≥ ∑ p ∈ P ℓ ( p ) − ∣ N ∣ \sum_{p\in P}\ell(p)-|M|\ge\sum_{p\in P}\ell(p)-|N| ∑ p ∈ P ℓ ( p ) − ∣ M ∣ ≥ ∑ p ∈ P ℓ ( p ) − ∣ N ∣ , which implies ∣ N ∣ ≥ ∣ M ∣ |N|\ge|M| ∣ N ∣ ≥ ∣ M ∣ .
In Step (A), we compute a matching M M M that is an RMM-MIN-TOT matching in G ′ G' G ′ . In Step (B), we show how to compute a matching M ∗ M^* M ∗ that is an RMM-MIN-TOT matching in G G G by augmenting the matching M M M in the fixed quota setting instance G x G_x G x . We augment the matching M M M such that, in the j j j -th augmentation, we obtain a rank-maximal matching M j M_j M j among all matchings of cardinality ∣ M ∣ + j |M|+j ∣ M ∣ + j in G x G_x G x such that d t o t ( M ) = d t o t ( M j ) d_{\mathrm{tot}}(M)=d_{\mathrm{tot}}(M_j) d tot ( M ) = d tot ( M j ) .
Step (B): Computing a solution for RMM-MIN-TOT in G G G by augmenting M M M in $G_x. Our algorithm is iterative, and we begin with the matching M 0 = M M_0=M M 0 = M . Suppose that after the iteration j − 1 j-1 j − 1 , we have computed a matching M j − 1 M_{j-1} M j − 1 having cardinality ∣ M ∣ + j − 1 |M|+j-1 ∣ M ∣ + j − 1 , and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) . In iteration j j j , we augment M j − 1 M_{j-1} M j − 1 in G x G_x G x by computing an s s s -t t t path in a directed graph H j H_j H j with costs as defined below. We show that the resulting matching M j M_j M j is a rank-maximal matching among all matchings having cardinality ∣ M ∣ + j |M|+j ∣ M ∣ + j and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) . Since a rank-maximal matching among all minimum total deviation matchings need not have maximum cardinality, we retain the most rank-maximal matching obtained during the augmentation procedure. That is, initially we set M ∗ = M 0 M^*=M_0 M ∗ = M 0 . After computing a matching M j M_j M j , if σ ( M j ) ≻ R σ ( M ∗ ) \sigma(M_j)\succ_R\sigma(M^*) σ ( M j ) ≻ R σ ( M ∗ ) , we update M ∗ = M j M^*=M_j M ∗ = M j . The augmentation procedure continues until the graph H j H_j H j does not admit an s s s -t t t path. At the end of Step (B), we return M ∗ M^* M ∗ .
We now describe the construction of the directed graph H j H_j H j . The vertices of H j H_j H j are defined as follows:
V ( H j ) = { s , t } ∪ A ∪ P . V(H_j)=\{s,t\}\cup A\cup P. V ( H j ) = { s , t } ∪ A ∪ P .
Let A ′ A' A ′ denote the set of applicants that are unmatched in M j − 1 M_{j-1} M j − 1 , and let P ′ P' P ′ denote the set of posts with ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) \ell(p)\le|M_{j-1}(p)|<u(p) ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) . Note that every post p ∈ P ′ p\in P' p ∈ P ′ satisfies d M j − 1 ( p ) = 0 d_{M_{j-1}}(p)=0 d M j − 1 ( p ) = 0 , and P ′ P' P ′ is exactly the set of posts to which one additional applicant can be matched without increasing the total deviation. We claim that it is sufficient to restrict our attention to posts in P ′ P' P ′ because:
For any iteration j j j , if we have a post p p p with ∣ M j − 1 ( p ) ∣ < ℓ ( p ) |M_{j-1}(p)|<\ell(p) ∣ M j − 1 ( p ) ∣ < ℓ ( p ) , then all the applicants in the neighbourhood of p p p must be matched in M j − 1 M_{j-1} M j − 1 . Suppose not. Let a a a be an unmatched applicant in the neighbourhood of p p p with respect to the matching M j − 1 M_{j-1} M j − 1 . Then, by adding the edge ( a , p ) (a,p) ( a , p ) to M j − 1 M_{j-1} M j − 1 , we could reduce the deviation of p p p , and thus reduce the total deviation. For j = 0 j=0 j = 0 , this would contradict the fact that the matching M 0 = M M_0=M M 0 = M is a matching with minimum total deviation in both G ′ G' G ′ and G G G .
In an optimal matching, no post incurs a deviation from the upper target.
Now, we define our edge set E ( H j ) E(H_j) E ( H j ) as follows:
E ( H j ) = E s A ′ ∪ E A P ∪ E P A ∪ E P ′ t where, E s A ′ = { ( s , a ) : a ∈ A ′ } E A P = { ( a , p ) : ( a , p ) ∈ E ∖ M j − 1 } E P A = { ( p , a ) : ( a , p ) ∈ E ∩ M j − 1 } E P ′ t = { ( p , t ) : p ∈ P ′ } \begin{aligned}
E(H_j)&=\mathcal{E}_{sA'}\cup\mathcal{E}_{AP}\cup\mathcal{E}_{PA}\cup\mathcal{E}_{P't}\text{ where,}\\
\mathcal{E}_{sA'}&=\{(s,a):a\in A'\}\\
\mathcal{E}_{AP}&=\{(a,p):(a,p)\in E\setminus M_{j-1}\}\\
\mathcal{E}_{PA}&=\{(p,a):(a,p)\in E\cap M_{j-1}\}\\
\mathcal{E}_{P't}&=\{(p,t):p\in P'\}
\end{aligned} E ( H j ) E s A ′ E A P E P A E P ′ t = E s A ′ ∪ E A P ∪ E P A ∪ E P ′ t where, = {( s , a ) : a ∈ A ′ } = {( a , p ) : ( a , p ) ∈ E ∖ M j − 1 } = {( p , a ) : ( a , p ) ∈ E ∩ M j − 1 } = {( p , t ) : p ∈ P ′ }
Cost of the edges in H j H_j H j . For an edge ( a , p ) ∈ E (a,p) \in E ( a , p ) ∈ E of rank i i i ,
if ( a , p ) ∈ E A P (a,p) \in\mathcal{E}_{AP} ( a , p ) ∈ E A P , cost of the edge is − ( n + 1 ) r − i -(n+1)^{r-i} − ( n + 1 ) r − i
if ( p , a ) ∈ E P A (p,a) \in\mathcal{E}_{PA} ( p , a ) ∈ E P A , cost of the edge is ( n + 1 ) r − i (n+1)^{r-i} ( n + 1 ) r − i
All other edges in H j H_j H j have a cost of 0 0 0 .
The following observation establishes the correspondence between the alternating components in the symmetric difference of two matchings and the directed graph H j H_j H j .
Observation 3. Let N N N be a matching in G x G_x G x having cardinality ∣ M ∣ + j |M|+j ∣ M ∣ + j and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) . Then every alternating cycle in M j − 1 ⊕ N M_{j-1} \oplus N M j − 1 ⊕ N corresponds to a directed cycle in H j H_j H j , and every augmenting path in M j − 1 ⊕ N M_{j-1} \oplus N M j − 1 ⊕ N corresponds to a directed s s s -t t t path in H j H_j H j .
We now prove an important property of the directed graph H j H_j H j .
Claim 5. There are no negative cost directed cycles in H j H_j H j .
Proof: We prove the claim by induction on the number of iterations. Base case is trivial as the initial matching M 0 = M M_0=M M 0 = M is a rank-maximal matching among all matchings having cardinality ∣ M ∣ |M| ∣ M ∣ and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) . Assume inductively that M j − 1 M_{j-1} M j − 1 is a rank-maximal matching among all matchings having cardinality ∣ M ∣ + j − 1 |M|+j-1 ∣ M ∣ + j − 1 and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) . Suppose, for contradiction, that H j H_j H j contains a negative cost directed cycle C C C . By the construction of H j H_j H j , the directed cycle C C C corresponds to an alternating cycle with respect to M j − 1 M_{j-1} M j − 1 .
Let M ′ = M j − 1 ⊕ C M'=M_{j-1} \oplus C M ′ = M j − 1 ⊕ C . Since C C C is an alternating cycle, ∣ M ′ ∣ = ∣ M j − 1 ∣ = ∣ M ∣ + j − 1 |M'|=|M_{j-1}|=|M|+j-1 ∣ M ′ ∣ = ∣ M j − 1 ∣ = ∣ M ∣ + j − 1 . Further, switching along an alternating cycle does not change the number of applicants assigned to any post. Hence, d t o t ( M ′ ) = d t o t ( M j − 1 ) = d t o t ( M ) d_{\mathrm{tot}}(M')=d_{\mathrm{tot}}(M_{j-1})=d_{\mathrm{tot}}(M) d tot ( M ′ ) = d tot ( M j − 1 ) = d tot ( M ) . Since C C C has negative cost, cost ( M ′ ) < cost ( M j − 1 ) \operatorname{cost}(M')<\operatorname{cost}(M_{j-1}) cost ( M ′ ) < cost ( M j − 1 ) . By Lemma 1, σ ( M ′ ) ≻ R σ ( M j − 1 ) \sigma(M') \succ_R \sigma(M_{j-1}) σ ( M ′ ) ≻ R σ ( M j − 1 ) , contradicting the induction hypothesis. Hence, H j H_j H j does not contain any negative cost directed cycle.
Now we describe our augmentation process. Let T j ′ T'_j T j ′ denote a min-cost s s s -t t t path in H j H_j H j , and let T j = T j ′ ∩ E T_j=T'_j \cap E T j = T j ′ ∩ E be the underlying undirected path in G x G_x G x . From the construction of the directed graph H j H_j H j , it is easy to see that T j T_j T j is an augmenting path with respect to M j − 1 M_{j-1} M j − 1 . We augment the matching M j − 1 M_{j-1} M j − 1 using T j T_j T j , and the resulting matching is M j = M j − 1 ⊕ T j M_j=M_{j-1} \oplus T_j M j = M j − 1 ⊕ T j .
For a set S ⊆ E S \subseteq E S ⊆ E , let # i ( S ) \#_i(S) # i ( S ) denote the number of rank i i i edges in S S S . We require Definition 9 to prove correctness.
Definition 9 (Signature of a path T j T_j T j ). We define the signature of a path T j T_j T j with respect to the matching M j − 1 M_{j-1} M j − 1 as an r r r -tuple ( x 1 , x 2 , … , x r ) (x_1,x_2,\ldots,x_r) ( x 1 , x 2 , … , x r ) denoted by σ ( T j ) \sigma(T_j) σ ( T j ) , where
x i = # i ( T j ∩ M j − 1 ) − # i ( T j ∖ M j − 1 ) x_i=\#_i(T_j \cap M_{j-1})-\#_i(T_j \setminus M_{j-1}) x i = # i ( T j ∩ M j − 1 ) − # i ( T j ∖ M j − 1 ) Note that, unlike the signature of a matching, which contains non-negative values, σ ( T j ) \sigma(T_j) σ ( T j ) may contain negative values. It is useful to note the connection between the signature of a path σ ( T j ) \sigma(T_j) σ ( T j ) and the cost of the path cost ( T j ) \operatorname{cost}(T_j) cost ( T j ) .
cost ( T j ) = ∑ i = 1 r x i ( n + 1 ) r − i . \operatorname{cost}(T_j)=\sum_{i=1}^{r}x_i(n+1)^{r-i}. cost ( T j ) = i = 1 ∑ r x i ( n + 1 ) r − i .
We observe the following:
Observation 4. ∑ i = 1 r x i = − 1 \sum_{i=1}^{r} x_i=-1 ∑ i = 1 r x i = − 1 .
Since T j T_j T j is an augmenting path, the number of unmatched edges in T j T_j T j is one more than the number of matched edges in T j T_j T j . Thus, we have Observation 4. Let σ ( M j − 1 ) = ( y 1 , y 2 , … , y r ) \sigma(M_{j-1})=(y_1,y_2,\ldots,y_r) σ ( M j − 1 ) = ( y 1 , y 2 , … , y r ) . For any i i i , the value of x i x_i x i cannot be greater than the number of matched rank i i i edges in M j − 1 M_{j-1} M j − 1 . This is stated as Observation 5.
Observation 5. For any i ∈ [ r ] i\in[r] i ∈ [ r ] , x i ≤ y i x_i\le y_i x i ≤ y i .
Since M j = M j − 1 ⊕ T j M_j=M_{j-1}\oplus T_j M j = M j − 1 ⊕ T j , it is easy to observe that σ ( M j ) = σ ( M j − 1 ) − σ ( T j ) \sigma(M_j)=\sigma(M_{j-1})-\sigma(T_j) σ ( M j ) = σ ( M j − 1 ) − σ ( T j ) .
Observation 6. Every component in σ ( M j ) \sigma(M_j) σ ( M j ) is non-negative.
Observation 6 follows from Observation 5. We state a series of claims to prove the correctness of Step (B). We ensure that our augmentations do not change the value of total deviation of the resulting matching, and this is stated in Claim 6.
Claim 6. If d t o t ( M ) = k d_{\mathrm{tot}}(M)=k d tot ( M ) = k , then d t o t ( M j ) = k d_{\mathrm{tot}}(M_j)=k d tot ( M j ) = k .
Proof: We need to show that at each iteration j j j , the augmentation preserves the value of total deviation. We use induction to prove the claim. The base case is trivial, that is, when j = 0 j=0 j = 0 , the initial matching M 0 = M M_0=M M 0 = M has a total deviation of k k k . We assume that the total deviation of matching M j − 1 M_{j-1} M j − 1 computed in iteration j − 1 j-1 j − 1 is k k k . Let T j ′ T'_j T j ′ be a minimum cost s s s -t t t path in H j H_j H j , and let T j T_j T j be the corresponding augmenting path in iteration j j j . The path T j T_j T j starts at an unmatched applicant a a a in M j − 1 M_{j-1} M j − 1 and ends at a post p p p with ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) \ell(p)\le|M_{j-1}(p)|<u(p) ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) . After augmenting M j − 1 M_{j-1} M j − 1 with T j T_j T j , a post p ′ ≠ p p'\ne p p ′ = p in P \mathcal{P} P has ∣ M j ( p ′ ) ∣ = ∣ M j − 1 ( p ′ ) ∣ |M_j(p')|=|M_{j-1}(p')| ∣ M j ( p ′ ) ∣ = ∣ M j − 1 ( p ′ ) ∣ , and thus the deviation of this post remains unchanged. For the post p p p , ∣ M j ( p ) ∣ = ∣ M j − 1 ( p ) ∣ + 1 |M_j(p)|=|M_{j-1}(p)|+1 ∣ M j ( p ) ∣ = ∣ M j − 1 ( p ) ∣ + 1 , and since ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) \ell(p)\le|M_{j-1}(p)|<u(p) ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) , the deviation of post p p p remains 0. Hence, the total deviation d t o t ( M j ) = k d_{\mathrm{tot}}(M_j)=k d tot ( M j ) = k . Thus, a matching computed in any iteration of Step (B) has a total deviation of k k k .
Next, we show that as the cost of path decreases, signature of the path with respect to rank-maximality also decreases.
Claim 7. Let T j ′ T'_j T j ′ and Q j ′ Q'_j Q j ′ be two s s s -t t t paths in H j H_j H j , and let M T = M j − 1 ⊕ T j M_T=M_{j-1}\oplus T_j M T = M j − 1 ⊕ T j , and M Q = M j − 1 ⊕ T Q M_Q=M_{j-1}\oplus T_Q M Q = M j − 1 ⊕ T Q . If c o s t ( T j ′ ) < c o s t ( Q j ′ ) cost(T'_j)<cost(Q'_j) cos t ( T j ′ ) < cos t ( Q j ′ ) , then σ ( M T ) ≻ R σ ( M Q ) \sigma(M_T)\succ_R\sigma(M_Q) σ ( M T ) ≻ R σ ( M Q ) . Equivalently, σ ( T j ) ≺ R σ ( Q j ) \sigma(T_j)\prec_R\sigma(Q_j) σ ( T j ) ≺ R σ ( Q j ) .
Proof: By our cost assignment, c o s t ( T j ′ ) = c o s t ( M T ) − c o s t ( M j − 1 ) cost(T'_j)=cost(M_T)-cost(M_{j-1}) cos t ( T j ′ ) = cos t ( M T ) − cos t ( M j − 1 ) , and c o s t ( Q j ′ ) = c o s t ( M Q ) − c o s t ( M j − 1 ) cost(Q'_j)=cost(M_Q)-cost(M_{j-1}) cos t ( Q j ′ ) = cos t ( M Q ) − cos t ( M j − 1 ) . Therefore, c o s t ( T j ′ ) < c o s t ( Q j ′ ) cost(T'_j)<cost(Q'_j) cos t ( T j ′ ) < cos t ( Q j ′ ) implies c o s t ( M T ) < c o s t ( M Q ) cost(M_T)<cost(M_Q) cos t ( M T ) < cos t ( M Q ) . Since M T M_T M T and M Q M_Q M Q are matchings, by Lemma 1, σ ( M T ) ≻ R σ ( M Q ) \sigma(M_T)\succ_R\sigma(M_Q) σ ( M T ) ≻ R σ ( M Q ) . Since, σ ( M T ) = σ ( M j − 1 ) − σ ( T j ) \sigma(M_T)=\sigma(M_{j-1})-\sigma(T_j) σ ( M T ) = σ ( M j − 1 ) − σ ( T j ) , and σ ( M Q ) = σ ( M j − 1 ) − σ ( Q j ) \sigma(M_Q)=\sigma(M_{j-1})-\sigma(Q_j) σ ( M Q ) = σ ( M j − 1 ) − σ ( Q j ) , σ ( M T ) ≻ R σ ( M Q ) \sigma(M_T)\succ_R\sigma(M_Q) σ ( M T ) ≻ R σ ( M Q ) is equivalent to σ ( T j ) ≺ R σ ( Q j ) \sigma(T_j)\prec_R\sigma(Q_j) σ ( T j ) ≺ R σ ( Q j ) .
To prove the correctness of the augmentation step, we assume inductively that M j − 1 M_{j-1} M j − 1 is a rank-maximal matching among all matchings having cardinality ∣ M j − 1 ∣ |M_{j-1}| ∣ M j − 1 ∣ and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) , and establish the following lemma.
Lemma 10. Let N N N be a matching in G X G_X G X such that ∣ N ∣ = ∣ M j − 1 ∣ + 1 |N|=|M_{j-1}|+1 ∣ N ∣ = ∣ M j − 1 ∣ + 1 , and d t o t ( N ) = d t o t ( M j − 1 ) d_{\mathrm{tot}}(N)=d_{\mathrm{tot}}(M_{j-1}) d tot ( N ) = d tot ( M j − 1 ) . Then there exists an M j − 1 M_{j-1} M j − 1 augmenting path Q Q Q in M j − 1 ⊕ N M_{j-1}\oplus N M j − 1 ⊕ N , corresponding to a directed s s s -t t t path Q ′ Q' Q ′ in H j H_j H j , such that c o s t ( N ) − c o s t ( M j − 1 ) = c o s t ( Q ′ ) cost(N)-cost(M_{j-1})=cost(Q') cos t ( N ) − cos t ( M j − 1 ) = cos t ( Q ′ ) .
Proof: The symmetric difference M j − 1 ⊕ N M_{j-1}\oplus N M j − 1 ⊕ N can be decomposed into alternating path, alternating cycle and augmenting path components. Since, ∣ N ∣ = ∣ M j − 1 ∣ + 1 |N|=|M_{j-1}|+1 ∣ N ∣ = ∣ M j − 1 ∣ + 1 , the decomposition contains at least one M j − 1 M_{j-1} M j − 1 augmenting path. Let Q Q Q be such an augmenting path, terminating at
a post p p p . Augmenting M j − 1 M_{j-1} M j − 1 along Q Q Q increases the number of applicants matched to p p p by exactly one and does not change the number of applicants matched to any other post. The post p p p must be unsaturated in M j − 1 M_{j-1} M j − 1 and cannot be undersubscribed in M j − 1 M_{j-1} M j − 1 ; otherwise augmenting along Q Q Q would decrease the total deviation, contradicting the minimum total deviation of M j − 1 M_{j-1} M j − 1 . Thus, ℓ ( p ) ≤ ∣ M j − 1 ( p ) ∣ < u ( p ) \ell(p) \leq\lvert M_{j-1}(p) \rvert< u(p) ℓ ( p ) ≤ ∣ M j − 1 ( p )∣ < u ( p ) , and p ∈ P ′ p \in P' p ∈ P ′ . By Observation 3, Q Q Q corresponds to a directed s s s -t t t path Q ′ Q' Q ′ in H j H_j H j .
Let H = ( M j − 1 ⊕ N ) ∖ Q H = (M_{j-1} \oplus N) \setminus Q H = ( M j − 1 ⊕ N ) ∖ Q . Consider the graph H ′ H' H ′ obtained by augmenting M j − 1 M_{j-1} M j − 1 along H H H . Note that augmenting H ′ H' H ′ further by Q Q Q would give N N N . Thus, it must be the case that ∣ H ′ ∣ = ∣ M j − 1 ∣ \lvert H' \rvert= \lvert M_{j-1} \rvert ∣ H ′ ∣ = ∣ M j − 1 ∣ and d t o t ( H ′ ) = d t o t ( M j − 1 ) d_{\mathrm{tot}}(H') = d_{\mathrm{tot}}(M_{j-1}) d tot ( H ′ ) = d tot ( M j − 1 ) . Consequently, by the optimality of M j − 1 M_{j-1} M j − 1 , it must be the case that cost ( M j − 1 ) = cost ( H ′ ) = cost ( N ) − cost ( Q ) \operatorname{cost}(M_{j-1}) = \operatorname{cost}(H') = \operatorname{cost}(N) - \operatorname{cost}(Q) cost ( M j − 1 ) = cost ( H ′ ) = cost ( N ) − cost ( Q ) . By rearranging, we obtain cost ( N ) − cost ( M j − 1 ) = cost ( Q ′ ) \operatorname{cost}(N) - \operatorname{cost}(M_{j-1}) = \operatorname{cost}(Q') cost ( N ) − cost ( M j − 1 ) = cost ( Q ′ ) .
Now we prove the following property about the matching M j M_j M j computed in iteration j j j .
Lemma 11. The matching M j M_j M j computed in iteration j j j is rank-maximal among all matchings with cardinality ∣ M ∣ + j \lvert M \rvert+ j ∣ M ∣ + j and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) .
Proof: We prove this by induction on the number of iterations. The base case j = 0 j = 0 j = 0 follows from Step (A). Assume that M j − 1 M_{j-1} M j − 1 is a rank-maximal matching among all matchings having cardinality ∣ M ∣ + j − 1 \lvert M \rvert+ j - 1 ∣ M ∣ + j − 1 and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) . Now consider the graph H j H_j H j . By Claim 5, there are no negative cost directed cycles in H j H_j H j . Let T j ′ T'_j T j ′ be the minimum cost directed s s s -t t t augmenting path in H j H_j H j with respect to M j − 1 M_{j-1} M j − 1 and let M j = M j − 1 ⊕ T j M_j = M_{j-1} \oplus T_j M j = M j − 1 ⊕ T j . The cardinality of M j M_j M j is ∣ M ∣ + j \lvert M \rvert+ j ∣ M ∣ + j . By Claim 6, d t o t ( M j ) = d t o t ( M ) d_{\mathrm{tot}}(M_j) = d_{\mathrm{tot}}(M) d tot ( M j ) = d tot ( M ) . Consider any matching N N N such that ∣ N ∣ = ∣ M ∣ + j \lvert N \rvert= \lvert M \rvert+ j ∣ N ∣ = ∣ M ∣ + j , and d t o t ( N ) = d t o t ( M ) d_{\mathrm{tot}}(N) = d_{\mathrm{tot}}(M) d tot ( N ) = d tot ( M ) .
By Lemma 10, there exists an M j − 1 M_{j-1} M j − 1 augmenting path Q Q Q in M j − 1 ⊕ N M_{j-1} \oplus N M j − 1 ⊕ N , corresponding to a directed s s s -t t t path Q ′ Q' Q ′ , and by Lemma 10,
cost ( N ) − cost ( M j − 1 ) = cost ( Q ′ ) . \operatorname{cost}(N) - \operatorname{cost}(M_{j-1}) = \operatorname{cost}(Q'). cost ( N ) − cost ( M j − 1 ) = cost ( Q ′ ) .
Since, T j ′ T'_j T j ′ is a minimum cost directed s s s -t t t path, cost ( T j ′ ) ≤ cost ( Q ′ ) \operatorname{cost}(T'_j) \leq\operatorname{cost}(Q') cost ( T j ′ ) ≤ cost ( Q ′ ) . Therefore,
cost ( M j ) − cost ( M j − 1 ) = cost ( T j ′ ) ≤ cost ( Q ′ ) = cost ( N ) − cost ( M j − 1 ) . \operatorname{cost}(M_j) - \operatorname{cost}(M_{j-1}) = \operatorname{cost}(T'_j) \leq\operatorname{cost}(Q') = \operatorname{cost}(N) - \operatorname{cost}(M_{j-1}). cost ( M j ) − cost ( M j − 1 ) = cost ( T j ′ ) ≤ cost ( Q ′ ) = cost ( N ) − cost ( M j − 1 ) .
Thus, cost ( M j ) ≤ cost ( N ) \operatorname{cost}(M_j) \leq\operatorname{cost}(N) cost ( M j ) ≤ cost ( N ) . By Lemma 1, σ ( M j ) ⪰ R σ ( N ) \sigma(M_j) \succeq_R \sigma(N) σ ( M j ) ⪰ R σ ( N ) . Since the choice of N N N was arbitrary, M j M_j M j is rank-maximal among all matchings with cardinality ∣ M ∣ + j \lvert M \rvert+ j ∣ M ∣ + j and total deviation d t o t ( M ) d_{\mathrm{tot}}(M) d tot ( M ) .
Our iterative procedure halts in iteration j j j if the graph H j H_j H j does not admit any s s s -t t t path. Recall that we begin by setting M ∗ = M 0 M^* = M_0 M ∗ = M 0 , and in the iteration j j j , after computing M j M_j M j , if σ ( M j ) ≻ R σ ( M ∗ ) \sigma(M_j) \succ_R \sigma(M^*) σ ( M j ) ≻ R σ ( M ∗ ) , we set M ∗ = M j M^* = M_j M ∗ = M j . We return the matching M ∗ M^* M ∗ at the end of Step (B).
Lemma 12. The matching M ∗ M^* M ∗ returned by Step (B) is a solution to RMM-MIN-TOT in G G G .
Proof: From Claim 6, every matching M j M_j M j computed in Step (B) has minimum total deviation. Let N N N be a minimum total deviation matching in G G G . By Lemma 9, there exists an integer q ≥ 0 q \geq0 q ≥ 0 such that ∣ N ∣ = ∣ M ∣ + q \lvert N \rvert= \lvert M \rvert+ q ∣ N ∣ = ∣ M ∣ + q . By Lemma 11 , the matching M q M_q M q is rank-maximal among all minimum total deviation matchings of cardinality ∣ M ∣ + q \lvert M \rvert+ q ∣ M ∣ + q . Thus, σ ( M q ) ⪰ R σ ( N ) \sigma(M_q) \succeq_R \sigma(N) σ ( M q ) ⪰ R σ ( N ) . The algorithm retains a matching M ∗ M^* M ∗ whose signature is at least as good as that of every matching M j M_j M j computed in Step (B). Thus, σ ( M ∗ ) ⪰ R σ ( N ) \sigma(M^*) \succeq_R \sigma(N) σ ( M ∗ ) ⪰ R σ ( N ) . Since, N N N is an arbitrary minimum total deviation matching in G G G , the matching M ∗ M^* M ∗ is rank-maximal among all minimum total deviation matchings in G G G .
Illustration of algorithm for RMM-MIN-TOT. For an illustration, consider the soft quota setting instance G G G given in Figure 1 , and consider the instance G ′ G' G ′ . The matching obtained by invoking Step (A) is M = { ( a 1 , p 1 ) , ( a 3 , p 2 ) , ( a 5 , p 4 ) } M = \{(a_1,p_1),(a_3,p_2),(a_5,p_4)\} M = {( a 1 , p 1 ) , ( a 3 , p 2 ) , ( a 5 , p 4 )} with σ ( M ) = ( 1 , 2 , 0 ) \sigma(M) = (1,2,0) σ ( M ) = ( 1 , 2 , 0 ) (here we omit the number of unmatched applicants) and d t o t ( M ) = 2 d_{\mathrm{tot}}(M) = 2 d tot ( M ) = 2 , which is a solution to RMM-MIN-TOT in G ′ G' G ′ . To compute a solution to RMM-MIN-TOT in G G G , we apply our iterative algorithm as described in Step (B). Observe that there are two s s s -t t t paths in H 1 H_1 H 1 , and we select the min-cost s s s -t t t path T 1 ′ = ⟨ s , a 6 , p 6 , t ⟩ T_1' = \langle s,a_6,p_6,t\rangle T 1 ′ = ⟨ s , a 6 , p 6 , t ⟩ such that cost ( T 1 ) = − ( n + 1 ) 2 \operatorname{cost}(T_1) = -(n+1)^2 cost ( T 1 ) = − ( n + 1 ) 2 and σ ( T 1 ) = ( − 1 , 0 , 0 ) \sigma(T_1) = (-1,0,0) σ ( T 1 ) = ( − 1 , 0 , 0 ) . After the first augmentation, we get a matching, N 1 = { ( a 1 , p 1 ) , ( a 3 , p 2 ) , ( a 5 , p 4 ) , ( a 6 , p 6 ) } N_1 = \{(a_1,p_1),(a_3,p_2),(a_5,p_4),(a_6,p_6)\} N 1 = {( a 1 , p 1 ) , ( a 3 , p 2 ) , ( a 5 , p 4 ) , ( a 6 , p 6 )} that has a signature of ( 2 , 2 , 0 ) (2,2,0) ( 2 , 2 , 0 ) . Observe that N 1 N_1 N 1 is a rank-maximal matching among all matchings with cardinality 4 in G G G . In the next iteration, we select the s s s -t t t path T 2 ′ = ⟨ s , a 4 , p 7 , t ⟩ T_2' = \langle s,a_4,p_7,t\rangle T 2 ′ = ⟨ s , a 4 , p 7 , t ⟩ such that cost ( T 2 ) = − 1 \operatorname{cost}(T_2) = -1 cost ( T 2 ) = − 1 and σ ( T 2 ) = ( 0 , 0 , − 1 ) \sigma(T_2) = (0,0,-1) σ ( T 2 ) = ( 0 , 0 , − 1 ) . After the second augmentation, we get a matching N 2 = { ( a 1 , p 1 ) , ( a 3 , p 2 ) , ( a 4 , p 7 ) , ( a 5 , p 4 ) , ( a 6 , p 6 ) } N_2 = \{(a_1,p_1),(a_3,p_2),(a_4,p_7),(a_5,p_4),(a_6,p_6)\} N 2 = {( a 1 , p 1 ) , ( a 3 , p 2 ) , ( a 4 , p 7 ) , ( a 5 , p 4 ) , ( a 6 , p 6 )} that has a signature of ( 2 , 2 , 1 ) (2,2,1) ( 2 , 2 , 1 ) . Observe that, in the next iteration, the directed graph H 3 H_3 H 3 does not admit any s s s -t t t path, and thus N 2 N_2 N 2 is a solution to RMM-MIN-TOT problem in G G G . Note that the matching N 2 N_2 N 2 is the same as the matching M 1 M_1 M 1 listed in Table 1 .
Modification for Fairness
For the total deviation variant of the problem FAIR-MIN-TOT, we begin by constructing the network H H H in Step (A) as described in § 4.1 . We modify the cost assignment on the edges in H H H as follows.
Cost of the edges in H H H .
For every edge ( a , p ) ∈ E A P (a,p) \in\mathcal{E}_{AP} ( a , p ) ∈ E A P with rank i i i , we set a cost of ( n + 1 ) i (n+1)^i ( n + 1 ) i .
Due to the cost assignment, any min-cost flow in H H H corresponds to a matching M M M , which is a solution to FAIR-MIN-TOT problem in the restricted instance G ′ G' G ′ .
In Step (B), we augment the matching M M M in G x G_x G x to compute a solution to FAIR-MIN-TOT problem in G G G . We construct a directed graph H j H_j H j with costs on edges as described in Step (B). However, we modify the cost assignment as follows.
Cost of the edges in H j H_j H j . For an edge ( a , p ) ∈ E (a,p) \in E ( a , p ) ∈ E of rank i i i ,
The procedure of augmentation is the same as that described in Step (B).
MIN-MAX Variants
To solve the MIN-MAX type problems in the soft quota setting, namely, OPT-SIGN-MIN-MAX and OPT-MIN-MAX, we exploit their connection to related problems in the fixed quota setting. In particular, to obtain our solutions, we compute optimal matchings (with respect to preferences) among all the matchings that are feasible in the fixed quota setting instance.
We consider an instance of fixed quota setting G G G , where each post p p p has an associated lower quota q ‾ ( p ) \underline{q}(p) q ( p ) and an upper quota q ‾ ( p ) \overline{q}(p) q ( p ) . For clarity, we denote the lower quota and upper quota of a post p p p in G G G by q ‾ G ( p ) \underline{q}_G(p) q G ( p ) , and q ‾ G ( p ) \overline{q}_G(p) q G ( p ) , respectively. When the instance is clear from the context, we omit the subscript G G G . Assuming that a feasible matching exists in the instance, we first investigate the problem OPT-LQ, which aims to compute a matching that is optimal with respect to the notion of OPT among all feasible matchings of the instance. Note that here, OPT can be set to either rank-maximality or fairness. Recall that in the fixed quota setting, where the lower quota of every post is zero, both these notions are guaranteed to exist, and optimal matchings are efficiently computable by the algorithms given in [21 , 22 , 25 ] . Now, we extend these algorithms to compute an optimal matching among all feasible matchings by adapting the algorithm in [25 ] . Assuming that feasible matchings exist in G G G , we present the algorithm for RMM-LQ.
Given an instance G G G of the RMM-LQ problem, we construct a fixed quota setting instance G ′ G' G ′ , where the lower quota of every post is set to 0. For an instance of the fixed quota setting, where the lower quota of every post is 0, we denote by MAX-CARD-RMM the problem of computing a rank-maximal matching among all maximum matchings in the instance. We reduce the problem of computing RMM-LQ in G G G to the problem of computing MAX-CARD-RMM in G ′ G' G ′ .
Reduction from RMM-LQ to MAX-CARD-RMM
Given an instance G G G of RMM-LQ, we construct an instance G ′ G' G ′ of the fixed quota setting, where the lower quota of every post is 0, as follows. In the instance G ′ G' G ′ , we retain the applicants A \mathcal{A} A , posts P \mathcal{P} P , and the preferences of applicants over posts from the instance G G G . For every post p ∈ P p \in\mathcal{P} p ∈ P , we set the lower quota q G ′ − ( p ) = 0 q^-_{G'}(p) = 0 q G ′ − ( p ) = 0 , and upper quota q G ′ + ( p ) = q G + ( p ) q^+_{G'}(p) = q^+_G(p) q G ′ + ( p ) = q G + ( p ) . For a post p ∈ P p \in\mathcal{P} p ∈ P , we introduce q G + ( p ) − q G − ( p ) q^+_G(p) - q^-_G(p) q G + ( p ) − q G − ( p ) many dummy applicants and add a rank r + 1 r+1 r + 1 edge incident to p p p for each such applicant. Let U = ∑ p ∈ P q G + ( p ) U = \sum_{p\in\mathcal{P}} q^+_G(p) U = ∑ p ∈ P q G + ( p ) . We show a one-to-one correspondence between a matching with cardinality U U U in G ′ G' G ′ and a feasible matching in G G G , as stated in Claim 8.
Claim 8. G ′ G' G ′ admits a matching of cardinality U U U if and only if G G G admits a feasible matching.
Proof: Suppose that G G G admits a feasible matching, say M M M . We construct a matching M ′ M' M ′ in G ′ G' G ′ from M M M such that ∣ M ′ ∣ = U |M'| = U ∣ M ′ ∣ = U . In the matching M ′ M' M ′ , we retain all the edges from M M M . For every post p p p , we match as many dummy applicants as possible so that the post becomes fully-subscribed in M ′ M' M ′ with respect to its upper quota q G ′ + ( p ) = q G + ( p ) q^+_{G'}(p) = q^+_G(p) q G ′ + ( p ) = q G + ( p ) . Observe that ∣ M ′ ∣ = U |M'| = U ∣ M ′ ∣ = U .
On the other hand, suppose that G ′ G' G ′ admits a matching M ′ M' M ′ such that ∣ M ′ ∣ = U |M'| = U ∣ M ′ ∣ = U . We construct a matching M M M in G G G by removing all the dummy applicants matched to a post p ∈ P p \in\mathcal{P} p ∈ P in M ′ M' M ′ . Note that, for a post p ∈ P p \in\mathcal{P} p ∈ P , the number of dummy applicants matched to p p p in M ′ M' M ′ is at most q G + ( p ) − q G − ( p ) q^+_G(p) - q^-_G(p) q G + ( p ) − q G − ( p ) . Hence, the number of true applicants matched to p p p in M ′ M' M ′ is at least q G − ( p ) q^-_G(p) q G − ( p ) . Thus, for every post p p p , we have ∣ M ( p ) ∣ = q G − ( p ) |M(p)| = q^-_G(p) ∣ M ( p ) ∣ = q G − ( p ) , and therefore M M M is a feasible matching in G G G . □ \square □
:::
We state the following claim about a feasible matching in G G G and maximum matchings in G ′ G' G ′ with cardinality U U U .
Claim 9. Let G G G and G ′ G' G ′ be the instances as defined above. Then,
For any feasible matching M M M in G G G with σ ( M ) = ( x 1 , x 2 , … , x r ) \sigma(M) = (x_1, x_2, \ldots, x_r) σ ( M ) = ( x 1 , x 2 , … , x r ) and cardinality S = ∑ i = 1 r x i S = \sum_{i=1}^{r} x_i S = ∑ i = 1 r x i , there exists a corresponding maximum matching M ′ M' M ′ in G ′ G' G ′ with σ ( M ′ ) = ( x 1 , x 2 , … , x r , U − S ) \sigma(M') = (x_1, x_2, \ldots, x_r, U-S) σ ( M ′ ) = ( x 1 , x 2 , … , x r , U − S ) .
For a maximum matching M ′ M' M ′ in G ′ G' G ′ with σ ( M ′ ) = ( x 1 , x 2 , … , x r , x r + 1 ) \sigma(M') = (x_1, x_2, \ldots, x_r, x_{r+1}) σ ( M ′ ) = ( x 1 , x 2 , … , x r , x r + 1 ) , and ∣ M ′ ∣ = U |M'| = U ∣ M ′ ∣ = U , there exists a corresponding feasible matching M M M in G G G with σ ( M ) = ( x 1 , x 2 , … , x r ) \sigma(M) = (x_1, x_2, \ldots, x_r) σ ( M ) = ( x 1 , x 2 , … , x r ) .
The proof of the above claim follows directly from the proof of Claim 8.
Lemma 13. Let M ′ M' M ′ be a solution to MAX-CARD-RMM problem in G ′ G' G ′ such that ∣ M ′ ∣ = U |M'| = U ∣ M ′ ∣ = U , and let M M M be the corresponding matching in G G G . Then M M M is a solution to RMM-LQ problem in G G G .
Proof. Since ∣ M ′ ∣ = U |M'| = U ∣ M ′ ∣ = U , it follows from Claim 8 that G G G admits a feasible matching. Let the signature of M ′ M' M ′ be σ ( M ′ ) = ( x 1 , x 2 , … , x r , x r + 1 ) \sigma(M') = (x_1, x_2, \ldots, x_r, x_{r+1}) σ ( M ′ ) = ( x 1 , x 2 , … , x r , x r + 1 ) . Then, by Claim 9(ii), the signature of the corresponding matching M M M in G G G is σ ( M ) = ( x 1 , x 2 , … , x r ) \sigma(M) = (x_1, x_2, \ldots, x_r) σ ( M ) = ( x 1 , x 2 , … , x r ) . Suppose for the sake of contradiction, that M M M is not a solution to RMM-LQ problem in G G G . Then there exists another matching, say M 1 M_1 M 1 , which is a solution to RMM-LQ problem in G G G . Let σ ( M 1 ) = ( y 1 , y 2 , … , y r ) \sigma(M_1) = (y_1, y_2, \ldots, y_r) σ ( M 1 ) = ( y 1 , y 2 , … , y r ) . Now, consider the matching M 1 ′ M'_1 M 1 ′ in G ′ G' G ′ that corresponds to M 1 M_1 M 1 in G G G . By Claim 9(i), σ ( M 1 ′ ) = ( y 1 , y 2 , … , y r , U − S ) \sigma(M'_1) = (y_1, y_2, \ldots, y_r, U-S) σ ( M 1 ′ ) = ( y 1 , y 2 , … , y r , U − S ) , where S = ∑ i = 1 r y i S = \sum_{i=1}^{r} y_i S = ∑ i = 1 r y i . Observe that, since σ ( M 1 ) ≻ R σ ( M ) \sigma(M_1) \succ_R \sigma(M) σ ( M 1 ) ≻ R σ ( M ) in G G G , it follows that σ ( M 1 ′ ) ≻ R σ ( M ′ ) \sigma(M'_1) \succ_R \sigma(M') σ ( M 1 ′ ) ≻ R σ ( M ′ ) in G ′ G' G ′ , which contradicts the fact that M ′ M' M ′ is a solution to MAX-CARD-RMM problem in G ′ G' G ′ .
Modifications for fairness. Given an instance G G G of FAIR-LQ, we construct the same instance G ′ G' G ′ as described above. But instead of MAX-CARD-RMM, we reduce the problem of computing FAIR-LQ to a problem of computing fair matching on H H H . By applying the techniques used in [25 ] , both problems RMM-LQ and FAIR-LQ admit an O ~ ( r m n ) \widetilde{O}(rmn) O ( r mn ) algorithm.
Minimizing maximum deviation in the soft quota setting
Having described the algorithms for the problems RMM-LQ and FAIR-LQ in the fixed quota setting, we now go back to our original problem of minimizing maximum deviation in the soft quota setting. To solve the MIN-MAX type problems in the soft quota setting, namely OPT-MIN-MAX and OPT-SIGN-MIN-MAX, we use a reduction to problems in the fixed quota setting and apply the algorithms for the problems RMM-LQ and FAIR-LQ. We describe our algorithms for the preference optimality as rank-maximality. Analogously, we can solve the problems for the notion of fairness.
We begin by presenting a useful observation about an optimal solution to the problem RMM-MIN-MAX.
Observation 7. Let M ∗ M^* M ∗ be an optimal solution to RMM-MIN-MAX, and let Δ ∗ \Delta^* Δ ∗ be the optimal maximum deviation. Then, there is a post p p p in M ∗ M^* M ∗ , which has a lower deviation exactly equal to Δ ∗ \Delta^* Δ ∗ .
Proof. Suppose not. Then the lower deviation of all posts with respect to M ∗ M^* M ∗ is strictly less than Δ ∗ \Delta^* Δ ∗ . Let the maximum lower deviation of any post with respect to M ∗ M^* M ∗ be Δ ′ \Delta' Δ ′ . Since d max ( M ∗ ) = Δ ∗ d_{\max}(M^*) = \Delta^* d m a x ( M ∗ ) = Δ ∗ , there exists at least one post p ∈ P p \in\mathcal{P} p ∈ P whose upper deviation is Δ ∗ \Delta^* Δ ∗ . Let P u \mathcal{P}_u P u be the set of posts that deviate from their upper target with respect to M ∗ M^* M ∗ , such that ∣ M ∗ ( p ) ∣ > u ( p ) + Δ ′ |M^*(p)| > u(p) + \Delta' ∣ M ∗ ( p ) ∣ > u ( p ) + Δ ′ .
We construct a matching M ′ M' M ′ from M ∗ M^* M ∗ as follows. For every post p ∈ P u p \in\mathcal{P}_u p ∈ P u , we arbitrarily select ∣ M ∗ ( p ) ∣ − u ( p ) − Δ ′ |M^*(p)| - u(p) - \Delta' ∣ M ∗ ( p ) ∣ − u ( p ) − Δ ′ matched edges incident on p p p and delete them. We retain all other matched edges in M ∗ M^* M ∗ . Let the resulting matching be M ′ M' M ′ . Observe that for any post p p p , the upper deviation with respect to M ′ M' M ′ is upper bounded by Δ ′ \Delta' Δ ′ . Since we retained the matched edges corresponding to any post p ∉ P u p \notin\mathcal{P}_u p ∈ / P u in M ′ M' M ′ , the lower deviation of p p p with respect to M ′ M' M ′ is also upper bounded by Δ ′ \Delta' Δ ′ . Thus, d max ( M ′ ) = Δ ′ < Δ ∗ d_{\max}(M') = \Delta' < \Delta^* d m a x ( M ′ ) = Δ ′ < Δ ∗ , which contradicts the fact that M ∗ M^* M ∗ is a matching with minimum maximum deviation.
Next, we describe the reduction from soft quota setting to the fixed quota setting.
Reduction from soft quota setting to the fixed quota setting. Given an instance G G G of the soft quota setting, and a fixed value of maximum deviation Δ \Delta Δ , we construct a fixed quota setting instance H Δ H_{\Delta} H Δ as follows. In H Δ H_{\Delta} H Δ , the applicants, posts, and applicant preferences remain the same as those in G G G . For a post p p p , we set the lower quota as q − ( p ) = max { 0 , ℓ ( p ) − Δ } q^{-}(p)=\max\{0,\ell(p)-\Delta\} q − ( p ) = max { 0 , ℓ ( p ) − Δ } , and the upper quota as q + ( p ) = u ( p ) + Δ q^{+}(p)=u(p)+\Delta q + ( p ) = u ( p ) + Δ . Note that if H Δ H_{\Delta} H Δ admits a feasible matching, then the same matching is feasible for a fixed quota setting instance H Δ ′ H_{\Delta'} H Δ ′ for any deviation Δ ′ ≥ Δ \Delta' \ge\Delta Δ ′ ≥ Δ . This is because an increase in the deviation widens the range of acceptable numbers of applicants for a post.
Next, we present the algorithms for the RMM-MIN-MAX and RMM-SIGN-MIN-MAX problems.
Algorithm for RMM-MIN-MAX
Given an instance G G G of the soft quota setting, our goal is to compute a rank-maximal matching among all matchings that have a minimum value of maximum deviation. Under our assumption on ℓ ( p ) \ell(p) ℓ ( p ) , the maximum deviation of any post is upper bounded by ∣ A ∣ |\mathcal{A}| ∣ A ∣ . From Observation 7, the maximum deviation value of any matching is also upper bounded by ∣ A ∣ |\mathcal{A}| ∣ A ∣ . Therefore, the maximum deviation of any matching lies in the range [ 0 , ∣ A ∣ ] [0,|\mathcal{A}|] [ 0 , ∣ A ∣ ] . To compute the minimum value of maximum deviation, we start by guessing the maximum deviation value Δ \Delta Δ and checking whether the corresponding fixed quota setting instance H Δ H_{\Delta} H Δ admits a feasible matching. To check feasibility, we can ignore the preferences and use the standard flow network for the bipartite matching with demands on the edges. We perform a binary search on Δ \Delta Δ in the range [ 0 , ∣ A ∣ ] [0,|\mathcal{A}|] [ 0 , ∣ A ∣ ] to compute the smallest Δ \Delta Δ such that there exists a feasible solution. Let Δ ∗ \Delta^{*} Δ ∗ be the minimum value of Δ \Delta Δ obtained. Then, corresponding to Δ ∗ \Delta^{*} Δ ∗ , we compute a rank-maximal matching among all feasible matchings (RMM-LQ) in the fixed quota setting instance H Δ ∗ H_{\Delta^{*}} H Δ ∗ . By the definition of RMM-LQ, the resulting matching has the best possible signature with respect to the notion of rank-maximality while achieving the minimum value for the maximum deviation.
Algorithm for RMM-SIGN-MIN-MAX
Given an instance G G G of the soft quota setting, and an input signature ρ \rho ρ , our goal is to compute a matching M M M in M R \mathcal{M}_{R} M R (recall that M R \mathcal{M}_{R} M R is the set of matchings whose signatures are at least as good as ρ \rho ρ with respect to rank-maximality) that has a minimum value of maximum deviation. Under the assumption about ℓ ( p ) \ell(p) ℓ ( p ) , lower deviation of any post is upper bounded by ∣ A ∣ |\mathcal{A}| ∣ A ∣ . Similarly, the upper deviation of any post is upper bounded by ∣ A ∣ |\mathcal{A}| ∣ A ∣ . Therefore, the maximum deviation of any matching lies in the range [ 0 , ∣ A ∣ ] [0,|\mathcal{A}|] [ 0 , ∣ A ∣ ] . To compute the minimum value of maximum deviation for a matching in M R \mathcal{M}_{R} M R , we start by guessing the maximum deviation value Δ \Delta Δ and checking whether the corresponding fixed quota setting instance H Δ H_{\Delta} H Δ admits a feasible matching. If the instance H Δ H_{\Delta} H Δ admits a feasible matching, we compute a rank-maximal matching (RMM-LQ) M M M among all feasible matchings in H Δ H_{\Delta} H Δ . If σ ( M ) ⪰ R ρ \sigma(M) \succeq_{R} \rho σ ( M ) ⪰ R ρ , then M M M satisfies the signature requirement with respect to rank-maximality. We perform a binary search on Δ \Delta Δ in the range [ 0 , ∣ A ∣ ] [0,|\mathcal{A}|] [ 0 , ∣ A ∣ ] to compute the smallest Δ \Delta Δ such that there exists a matching that meets the signature requirement.
Below, we illustrate the execution of our algorithms for RMM-MIN-MAX and RMM-SIGN-MIN-MAX for the example instance in Figure 1 .
Illustration of algorithm for RMM-MIN-MAX. Given the instance G G G , for a given Δ \Delta Δ , we construct the corresponding fixed quota setting instance G Δ G_{\Delta} G Δ as described in our algorithm. Using binary search, we obtain the minimum value of the maximum deviation as Δ = 1 \Delta=1 Δ = 1 . We then compute an RMM-LQ in the fixed quota setting instance G 1 G_{1} G 1 . It is easy to verify that M 2 M_{2} M 2 , listed in Table 1 is a solution to the RMM-LQ problem in G 1 G_{1} G 1 , and hence a solution to RMM-MIN-MAX problem in G G G .
Illustration of algorithm for RMM-SIGN-MIN-MAX. Given the instance G G G , for a fixed value of Δ \Delta Δ , we construct the corresponding fixed quota setting instance G Δ G_{\Delta} G Δ as described in our algorithm. We then apply binary search on the maximum deviation value Δ \Delta Δ and solve the RMM-LQ problem in the fixed quota setting instance G Δ G_{\Delta} G Δ . For Δ = 2 \Delta= 2 Δ = 2 , we construct fixed quota setting instance G 2 G_{2} G 2 , and solve the RMM-LQ problem. It is easy to verify that M 4 M_{4} M 4 , listed in Table 1 , is a solution to the RMM-LQ problem in G 2 G_{2} G 2 . Since σ ( M 4 ) ⪰ R ( 4 , 0 , 0 , 3 ) \sigma(M_{4}) \succeq_{R} (4, 0, 0, 3) σ ( M 4 ) ⪰ R ( 4 , 0 , 0 , 3 ) , the matching is a feasible solution for the problem RMM-SIGN-MIN-MAX. It is easy to verify that any matching that meets the signature requirement has a maximum deviation of at least 2, and thus the matching M 4 M_{4} M 4 is an optimal solution for the RMM-SIGN-MIN-MAX problem.
Modification for Fairness in the soft quota setting
In this section, we state the necessary modifications required to solve the problems FAIR-MIN-MAX and FAIR-SIGN-MIN-MAX.
Algorithm for FAIR-MIN-MAX. Given an instance G G G of the soft quota setting, our goal is to compute a fair matching among all matchings that have a minimum value of maximum deviation. As in the algorithm for the RMM-MIN-MAX problem given in § 5.3 , we first compute the minimum value of maximum deviation, say Δ ∗ \Delta^{*} Δ ∗ . Then, corresponding to Δ ∗ \Delta^{*} Δ ∗ , we compute a fair matching among all feasible matchings (FAIR-LQ) in the fixed quota setting instance H Δ ∗ H_{\Delta^{*}} H Δ ∗ . By the definition of FAIR-LQ, the resulting matching has the best possible signature with respect to the notion of fairness while achieving the minimum value for the maximum deviation.
Algorithm for FAIR-SIGN-MIN-MAX. Given an instance G G G of the soft quota setting, and an input signature ρ \rho ρ , our goal is to compute a matching M M M in M F M_{\mathcal{F}} M F (recall that M F M_{\mathcal{F}} M F is the set of matchings whose signatures are at least as good as ρ \rho ρ with respect to fairness) that has a minimum value of maximum deviation. As in the algorithm for the problem RMM-SIGN-MIN-MAX given in § 5.4 , we guess a maximum deviation value Δ \Delta Δ and check whether the corresponding fixed quota setting instance H Δ H_{\Delta} H Δ admits a feasible matching. If the instance H Δ H_{\Delta} H Δ admits a feasible matching, we compute a fair matching (FAIR-LQ) M M M among all feasible matchings in H Δ H_{\Delta} H Δ . If σ ( M ) ⪰ F ρ \sigma(M) \succeq_{\mathcal{F}} \rho σ ( M ) ⪰ F ρ , then M M M satisfies the signature requirement with respect to fairness. We perform a binary search on Δ \Delta Δ in the range [ 0 , ∣ A ∣ ] [0,|\mathcal{A}|] [ 0 , ∣ A ∣ ] to compute the smallest Δ \Delta Δ such that there exists a matching that meets the signature requirement.
Optimizing both total deviation and maximum deviation
Our problems so far have been defined to optimize either the total deviation or the maximum deviation, but not both simultaneously. A natural question is whether there exists a matching that optimizes both the total deviation and the maximum deviation. To define our problems concretely, we fix the optimality notion as rank-maximality. In § 6.1 , we consider preference optimality first type of problems followed by deviation first type of problems in § 6.2 .
Preference optimality first
Recall that, in the preference optimality first type of the problem, we are given an instance of the soft quota setting along with a signature. The goal is to compute a matching that satisfies the signature with respect to rank-maximality while optimizing either the total deviation or the maximum deviation. The set of matchings that meet the signature requirement with respect to rank-maximality is denoted by M R \mathcal{M}_R M R . Within M R \mathcal{M}_R M R , the set of matchings that minimize the total deviation is denoted by M t ′ \mathcal{M}'_t M t ′ , while the set of matchings that minimize the maximum deviation is denoted by M m ′ \mathcal{M}'_m M m ′ . In the RMM-SIGN-MIN-TOT problem, the goal is to output any matching from M t ′ \mathcal{M}'_t M t ′ , whereas in the RMM-SIGN-MIN-MAX problem, the goal is to output any matching from M m ′ \mathcal{M}'_m M m ′ (see Figure 2 ).
Having seen efficient algorithms for the RMM-SIGN-MIN-TOT and RMM-SIGN-MIN-MAX problems, we now define a problem that aims to optimize both total deviation and maximum deviation simultaneously. That is, given an instance G G G of the soft quota setting and an input signature ρ \rho ρ , our goal is to decide whether the intersection of M t ′ \mathcal{M}'_t M t ′ and M m ′ \mathcal{M}'_m M m ′ is non-empty, and, if so, computing a matching from this intersection. This problem is denoted by RMM-SIGN-MIN-TM (marked as Q 1 Q_1 Q 1 in Figure 5 ), where the TM in the name indicates that our goal is to optimize both total and maximum deviations simultaneously. If the intersection of M t ′ \mathcal{M}'_t M t ′ and M m ′ \mathcal{M}'_m M m ′ is empty, we consider the following two optimization problems:
Figure 5. Optimizing both total deviation and maximum deviation for the problem RMM-SIGN-MIN-Y, where Y ∈ { T O T , M A X } Y \in\{TOT, MAX\} Y ∈ { T O T , M A X } .
RMM-SIGN-MIN-TM _M M : compute a matching that has minimum value of maximum deviation from the set M t ′ \mathcal{M}'_t M t ′ . This problem is denoted by RMM-SIGN-MIN-TM _M M (marked as Q 2 Q_2 Q 2 in Figure 5 ), where the TM _M M indicates that the primary objective is to minimize the total deviation. Within the set of matchings having minimum total deviation, denoted by M t ′ \mathcal{M}'_t M t ′ , the secondary objective is to minimize the maximum deviation.
RMM-SIGN-MIN-MT _T T : compute a matching that has minimum value of total deviation from the set M m ′ \mathcal{M}'_m M m ′ . This problem is denoted by RMM-SIGN-MIN-MT _T T (marked as Q 3 Q_3 Q 3 in Figure 5 ), where the MT _T T indicates that the primary objective is to minimize the maximum deviation. Within the set of matchings having minimum value of maximum deviation, denoted by M m ′ \mathcal{M}'_m M m ′ , the secondary objective is to minimize the total deviation.
We solve the above problems in polynomial time by adapting our algorithm for the problem RMM-SIGN-MIN-TOT. Recall that, for a given total deviation Δ \Delta Δ and a split ( l d , u d ) (ld,ud) ( l d , u d ) such that Δ = l d + u d \Delta= ld + ud Δ = l d + u d , if the network H ( l d , u d ) H_{(ld,ud)} H ( l d , u d ) (shown in Figure 3 ) admits a feasible flow, then the total deviation of the corresponding matching is at most Δ \Delta Δ . However, there are no guarantees on the maximum deviation of the computed matching. In the network depicted in Figure 3 , the lower deviation for a post p p p is controlled by the capacity of the edge ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) , while the upper deviation is constrained by the capacity of the edge ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) . By modifying the capacities of these edges, we can bound the maximum deviation. To solve our problems, we modify the network so that we can restrict our attention to matchings with specific values of total deviation and maximum deviation.
Suppose that, for a given instance G G G and an input signature ρ \rho ρ , the optimal values of the total deviation and the maximum deviation are Δ t ′ \Delta'_t Δ t ′ and Δ m ′ \Delta'_m Δ m ′ , respectively. That is, every matching in M t ′ \mathcal{M}'_t M t ′ has total deviation Δ t ′ \Delta'_t Δ t ′ , whereas every matching in M m ′ \mathcal{M}'_m M m ′ has maximum deviation Δ m ′ \Delta'_m Δ m ′ . We now describe our algorithms.
Algorithm for RMM-SIGN-MIN-TM. To determine whether the set M t ′ ∩ M m ′ \mathcal{M}'_t \cap\mathcal{M}'_m M t ′ ∩ M m ′ is non-empty we make use of our network in Figure 3 . We note that, since the optimal value of total deviation is Δ t ′ \Delta'_t Δ t ′ , the network H Δ t ′ H_{\Delta'_t} H Δ t ′ for a particular split as Δ t ′ = l d + u d \Delta'_t=ld+ud Δ t ′ = l d + u d admits a feasible flow, and the corresponding matching satisfies the signature requirement. To restrict our attention to matchings with maximum deviation Δ m ′ \Delta'_m Δ m ′ , we apply the following modifications to the network.
For every post p ∈ P p \in\mathcal{P} p ∈ P , we set the capacities of the edges ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) to Δ m ′ \Delta'_m Δ m ′ instead of l d ld l d and u d ud u d , respectively.
Let the modified network be H ′ H' H ′ . For each split ( l d , u d ) (ld,ud) ( l d , u d ) of Δ t ′ \Delta'_t Δ t ′ , we compute a min-cost flow in the network H ( l d , u d ) ′ H'_{(ld,ud)} H ( l d , u d ) ′ , and check whether the corresponding matching satisfies the signature requirement. As in the algorithm for RMM-SIGN-MIN-TOT, we consider all possible splits of Δ t ′ \Delta'_t Δ t ′ . If for any split, say ( l d ∗ , u d ∗ ) (ld^*,ud^*) ( l d ∗ , u d ∗ ) , the matching corresponding to the min-cost flow, say M M M meets the signature requirement, then the intersection of M t ′ \mathcal{M}'_t M t ′ and M m ′ \mathcal{M}'_m M m ′ is non-empty and we have found the required matching. If none of the splits lead to a matching that satisfies the signature requirement, then the intersection of M t ′ \mathcal{M}'_t M t ′ and M m ′ \mathcal{M}'_m M m ′ is empty.
Algorithm for RMM-SIGN-MIN-Tm _m m . In the problem RMM-SIGN-MIN-Tm _m m , the goal is to compute a matching that minimizes the maximum deviation from the set M t ′ \mathcal{M}'_t M t ′ . Observe that any matching in the set M t ′ \mathcal{M}'_t M t ′ has a maximum deviation of at least Δ m ′ \Delta'_m Δ m ′ and at most Δ t ′ \Delta'_t Δ t ′ . Therefore, we perform a linear search within this range to find the optimal value of the maximum deviation. For a specific value of maximum deviation, say i ∈ [ Δ m ′ , Δ t ′ ] i \in[\Delta'_m,\Delta'_t] i ∈ [ Δ m ′ , Δ t ′ ] , we apply the following modifications to the network given in Figure 3 .
For every post p ∈ P p \in\mathcal{P} p ∈ P , we set the capacities of the edges ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) to i i i instead of l d ld l d and u d ud u d , respectively, where i ∈ [ Δ m ′ , Δ t ′ ] i \in[\Delta'_m,\Delta'_t] i ∈ [ Δ m ′ , Δ t ′ ] .
Let the modified network be H ′ H' H ′ . For each split ( l d , u d ) (ld,ud) ( l d , u d ) of Δ t ′ \Delta'_t Δ t ′ , we compute a min-cost flow in the network H ( l d , u d ) ′ H'_{(ld,ud)} H ( l d , u d ) ′ , and check whether the corresponding matching satisfies the signature requirement. If for any split, say ( l d ∗ , u d ∗ ) (ld^*,ud^*) ( l d ∗ , u d ∗ ) , the matching corresponding to the min-cost flow, say M M M meets the signature requirement, then i i i is a candidate value for the maximum deviation. We perform a linear search on i i i to compute a matching in M t ′ \mathcal{M}'_t M t ′ having the smallest value of maximum deviation. With O ( Δ t ′ 2 ) O(\Delta_t'^2) O ( Δ t ′2 ) flow computations in the modified network H ′ H' H ′ , we can compute a solution for the problem. Since the value of Δ t ′ \Delta'_t Δ t ′ is polynomial in ∣ A ∣ |\mathcal{A}| ∣ A ∣ , the algorithm runs in polynomial time.
Algorithm for RMM-SIGN-MIN-MT _T T . In the problem RMM-SIGN-MIN-MT _T T , the goal is to compute a matching that minimizes total deviation from the set M m ′ \mathcal{M}'_m M m ′ . Observe that any matching in the set M m ′ \mathcal{M}'_m M m ′ has a total deviation of at least Δ t ′ \Delta'_t Δ t ′ and at most min { ∣ P ∣ ⋅ Δ m ′ , ∑ p ∈ P ℓ ( p ) + ∣ A ∣ } \min\{|\mathcal{P}|\cdot\Delta'_m,\sum_{p\in\mathcal{P}}\ell(p)+|\mathcal{A}|\} min { ∣ P ∣ ⋅ Δ m ′ , ∑ p ∈ P ℓ ( p ) + ∣ A ∣ } . Therefore, we perform a linear search within this range to find the optimal value of total deviation. We apply the following modifications to the network given in Figure 3 .
For every post p ∈ P p \in P p ∈ P , we set the capacities of the edges ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) and ( p ′ ′ , d ′ ′ ) (p'',d'') ( p ′′ , d ′′ ) to Δ m ′ \Delta'_m Δ m ′ instead of l d ld l d and u d ud u d , respectively.
Let the modified network be H ′ H' H ′ . Now, we apply our algorithm for RMM-SIGN-MIN-TOT on the modified network. For a given value of Δ \Delta Δ , we consider all possible splits corresponding to Δ \Delta Δ . If for any split, say ( l d ∗ , u d ∗ ) (ld^*,ud^*) ( l d ∗ , u d ∗ ) , the matching corresponding to the min-cost flow, say M M M meets the signature requirement, then Δ \Delta Δ is a candidate value for the total deviation. We perform a linear search on Δ \Delta Δ to compute a matching in M m ′ \mathcal{M}'_m M m ′ having the smallest value of total deviation. Note that the time complexity of the above algorithm is same as that of the algorithm for RMM-SIGN-MIN-TOT.
Deviation first
Now, we consider analogous problems in the deviation first variant. Recall that, in the deviation first type of the problem, we are given an instance of the soft quota setting, and our goal is to compute a rank-maximal matching among all matchings that optimize either the total deviation or the maximum deviation. We denote the set of matchings that minimize total deviation (or max deviation respectively) by M t \mathcal{M}_t M t (respectively, M m \mathcal{M}_m M m ). In the RMM-MIN-TOT problem, the goal is to output a rank-maximal matching from the set M t \mathcal{M}_t M t , while in the RMM-MIN-MAX problem the goal is to output a rank-maximal matching from the set M m \mathcal{M}_m M m .
We define analogous problems to optimize the total deviation and maximum deviation simultaneously as described in § 6.1 . Given an instance G G G of the soft quota setting, our goal is to decide whether the intersection of M t \mathcal{M}_t M t and M m \mathcal{M}_m M m is non-empty, and if so, compute a matching from the intersection. We denote this problem by RMM-MIN-TM (marked as Q 4 Q_4 Q 4 in Figure 6 ), where the TM in the problem name indicates that our goal is to optimize both the total and the maximum deviation simultaneously. If the intersection of M t \mathcal{M}_t M t and M m \mathcal{M}_m M m is empty, we focus on the following two optimization problems:
Figure 6. Optimizing both total deviation and maximum deviation for the problem RMM-MIN-Y, where Y ∈ { T O T , M A X } Y \in\{TOT, MAX\} Y ∈ { T O T , M A X } .
RMM-MIN-TM _M M : compute a matching that has minimum value of maximum deviation from the set M t \mathcal{M}_t M t . This problem is denoted by RMM-MIN-TM _M M (marked as Q 5 Q_5 Q 5 in Figure 6 ), where the TM _M M indicates that the primary objective is to minimize the total deviation. Within the set of matchings that have minimum value of total deviation, denoted by M t \mathcal{M}_t M t , the secondary objective is to minimize the maximum deviation.
RMM-MIN-TM _{\mathrm{M}} M : compute a matching that has minimum value of total deviation from the set M m \mathcal{M}_m M m . This problem is denoted by RMM-MIN-TM _{\mathrm{M}} M (marked as Q6 in Figure 6 ), where TM _{\mathrm{M}} M indicates that the primary objective is to minimize the maximum deviation. Within the set of matchings that have minimum value of maximum deviation, denoted by M m \mathcal{M}_m M m , the secondary objective is to minimize the total deviation.
We solve the above problems in polynomial time by adapting our algorithm for the problem RMM-SIGN-MIN-TOT. Suppose that, for a given instance G G G , the optimal values of the total deviation and the maximum deviation are Δ t \Delta_t Δ t and Δ m \Delta_m Δ m , respectively. That is, every matching in M t \mathcal{M}_t M t has total deviation Δ t \Delta_t Δ t , whereas every matching in M m \mathcal{M}_m M m has maximum deviation Δ m \Delta_m Δ m . Now we describe our algorithms.
Algorithm for RMM-MIN-TM _{\mathrm{M}} M . Recall that, in an optimal matching for the RMM-MIN-TOT problem, no post incurs a deviation with respect to the upper target. This implies that any matching in the intersection of M t \mathcal{M}_t M t and M m \mathcal{M}_m M m if it exists, has an upper deviation of 0. As described in § 6.1 , we restrict the maximum deviation of a post p p p to Δ m \Delta_m Δ m . To solve the RMM-MIN-TM _{\mathrm{M}} M problem, we modify the network given in Figure 3 as follows.
We set u d = 0 ud = 0 u d = 0 and l d = Δ t ld = \Delta_t l d = Δ t . Thus, we restrict our attention to matchings with total deviation Δ t \Delta_t Δ t (matchings in the set M t \mathcal{M}_t M t ).
For every post p ∈ P p \in\mathcal{P} p ∈ P , we set the capacity of the edge ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) as Δ m \Delta_m Δ m instead of l d ld l d .
We retain the demands and capacities of all other edges as they are in the original network given in Figure 3 .
Let the modified network be H ′ H' H ′ . If the network H ( Δ t , 0 ) ′ H'_{(\Delta_t,0)} H ( Δ t , 0 ) ′ admits a feasible flow, we compute a matching M M M corresponding to a min-cost flow. By the correctness of our algorithm for RMM-SIGN-MIN-TOT, M M M is a rank-maximal matching among all matchings with total deviation Δ t \Delta_t Δ t . By the construction of the network H ( Δ t , 0 ) ′ H'_{(\Delta_t,0)} H ( Δ t , 0 ) ′ , it follows that d t o t ( M ) = Δ t d_{\mathrm{tot}}(M) = \Delta_t d tot ( M ) = Δ t , and d m a x ( M ) = Δ m d_{\mathrm{max}}(M) = \Delta_m d max ( M ) = Δ m . Thus, M M M is a solution to the problem RMM-MIN-TM _{\mathrm{M}} M . If the network H ( Δ t , 0 ) ′ H'_{(\Delta_t,0)} H ( Δ t , 0 ) ′ does not admit any feasible flow, then M t \mathcal{M}_t M t and M m \mathcal{M}_m M m are disjoint.
Algorithm for RMM-MIN-Tm _{\mathrm{m}} m . In the problem RMM-MIN-Tm _{\mathrm{m}} m , the goal is to compute a matching that minimizes the maximum deviation from the set M t \mathcal{M}_t M t . Observe that any matching in the set M t \mathcal{M}_t M t has a maximum deviation of at least Δ m \Delta_m Δ m and at most Δ t \Delta_t Δ t . Therefore, we perform a linear search in this range to find the optimal value of maximum deviation. For a given value of maximum deviation, say i ∈ [ Δ m , Δ t ] i \in[\Delta_m,\Delta_t] i ∈ [ Δ m , Δ t ] , we apply the following modification to the network given in Figure 3 .
We set u d = 0 ud = 0 u d = 0 and l d = Δ t ld = \Delta_t l d = Δ t . Thus, we restrict our attention to matchings with total deviation Δ t \Delta_t Δ t (matchings in the set M t \mathcal{M}_t M t ).
For every post p ∈ P p \in\mathcal{P} p ∈ P , we set the capacity of the edge ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) as i i i instead of l d ld l d , where i ∈ [ Δ m , Δ t ] i \in[\Delta_m,\Delta_t] i ∈ [ Δ m , Δ t ] .
We retain the demands and capacities of all other edges as they are in the original network given in Figure 3 .
Let the modified network be H ′ H' H ′ . For a particular value of i i i , if the network H ( Δ t , 0 ) ′ H'_{(\Delta_t,0)} H ( Δ t , 0 ) ′ admits a feasible flow, then i i i is a candidate value for the maximum deviation. We perform a linear search on i i i to compute a matching in M t \mathcal{M}_t M t having the smallest value of maximum deviation. With O ( Δ t 2 ) O(\Delta_t^2) O ( Δ t 2 ) flow computations in the modified network H ′ H' H ′ , we can compute a solution to the problem. Since the value of Δ t \Delta_t Δ t is polynomial in ∣ A ∣ |\mathcal{A}| ∣ A ∣ , the algorithm runs in polynomial time.
Algorithm for RMM-MIN-MT _{\mathrm{T}} T . In the problem RMM-MIN-MT _{\mathrm{T}} T , the goal is to compute a matching that has the minimum value of total deviation from the set M m \mathcal{M}_m M m . Observe that any matching in the set M m \mathcal{M}_m M m has a total deviation of at least Δ m \Delta_m Δ m and at most min { ∣ P ∣ ⋅ Δ m , ∑ p ∈ P ℓ ( p ) } \min\{|\mathcal{P}|\cdot\Delta_m,\sum_{p\in\mathcal{P}}\ell(p)\} min { ∣ P ∣ ⋅ Δ m , ∑ p ∈ P ℓ ( p )} . Therefore, we perform a linear search within this range to find the optimal value of total deviation. We apply the following modification to the network given in Figure 3 .
We set u d = 0 ud=0 u d = 0 and l d = Δ ld=\Delta l d = Δ .
For every post p ∈ P p\in\mathcal{P} p ∈ P , we set the capacity of the edge ( d ′ , p ′ ) (d',p') ( d ′ , p ′ ) to Δ m \Delta_m Δ m instead of l d ld l d .
We retain the demands and capacities of all other edges as they are in the original network given in Figure 3 .
Let the modified network be H ′ H' H ′ . We now apply our algorithm for RMM-SIGN-MIN-TOT on the modified network. For a given value of Δ \Delta Δ , if the network H ( Δ , 0 ) ′ H'_{(\Delta,0)} H ( Δ , 0 ) ′ admits a feasible flow, then Δ \Delta Δ is a candidate value for the total deviation. We perform a linear search on Δ \Delta Δ to compute a matching in M m \mathcal{M}_m M m having the smallest value of total deviation. Note that the time complexity of the above algorithm is same as that of the algorithm for RMM-SIGN-MIN-TOT.
Generalized Soft Quota Setting
Having considered the problems in the soft quota setting, we now generalize our framework. In the soft quota setting, deviating by one unit from the given targets incurs a uniform deviation cost across all the posts. A natural generalization of the soft quota setting involves associating costs with these deviations. In an instance G G G of the generalized soft quota setting , every post p p p is associated with two non-zero integral costs – a lower deviation cost c ℓ ( p ) c_{\ell}(p) c ℓ ( p ) , and an upper deviation cost c u ( p ) c_u(p) c u ( p ) . These values represent the cost of deviating by one unit from the lower target and the upper target, respectively.
As in the soft quota setting, our goal in the generalized soft quota setting is to compute an assignment that has two orthogonal optimization objectives:
(i) Minimizing deviation cost. For a matching M M M , we define the total deviation cost d t c ( M ) d_{\mathrm{tc}}(M) d tc ( M ) , and the maximum deviation cost d m c ( M ) d_{\mathrm{mc}}(M) d mc ( M ) as below, and our goal is to minimize one of them. Let P ℓ P_{\ell} P ℓ and P u P_u P u denote the posts that deviate from their lower targets and upper targets, respectively, in M M M . Recall that a post p p p can deviate either from the lower target or from the upper target, but not both. Thus, the sets P ℓ P_{\ell} P ℓ and P u P_u P u are disjoint.
d t c ( M ) = ∑ p ∈ P ℓ d M ( p ) ⋅ c ℓ ( p ) + ∑ p ∈ P u d M ( p ) ⋅ c u ( p ) d_{\mathrm{tc}}(M)=\sum_{p\in P_{\ell}}d_M(p)\cdot c_{\ell}(p)+\sum_{p\in P_u}d_M(p)\cdot c_u(p) d tc ( M ) = p ∈ P ℓ ∑ d M ( p ) ⋅ c ℓ ( p ) + p ∈ P u ∑ d M ( p ) ⋅ c u ( p )
and
d m c ( M ) = max { max p ∈ P ℓ d M ( p ) ⋅ c ℓ ( p ) , max p ∈ P u d M ( p ) ⋅ c u ( p ) } d_{\mathrm{mc}}(M)=\max\left\{\max_{p\in P_{\ell}}d_M(p)\cdot c_{\ell}(p),\max_{p\in P_u}d_M(p)\cdot c_u(p)\right\} d mc ( M ) = max { p ∈ P ℓ max d M ( p ) ⋅ c ℓ ( p ) , p ∈ P u max d M ( p ) ⋅ c u ( p ) }
(ii) Optimality with respect to preferences. As done earlier, we use rank-maximality and fairness as our notions of optimality.
Our Problems and Results
In the generalized soft quota setting, we care about deviation cost as well as preference optimality, and this defines our problems.
Deviation cost first. In this type of problem, we give precedence to minimizing the deviation cost first, and subject to that, we optimize the preferences. Let M \mathcal{M} M be the set of all matchings in an instance G G G of a generalized soft quota setting. Let M t c \mathcal{M}_{tc} M t c (respectively M m c \mathcal{M}_{mc} M m c ) denote the set of matchings that have a minimum value of total deviation cost (respectively, the minimum value of maximum deviation cost). We define our first set of problems:
OPT-MIN-TOT-DC: The goal is to compute a matching that satisfies the notion O P T OPT O P T with respect to the preferences in the set M t c \mathcal{M}_{tc} M t c .
OPT-MIN-MAX-DC: The goal is to compute a matching that satisfies the notion O P T OPT O P T with respect to the preferences in the set M m c \mathcal{M}_{mc} M m c .
Preference optimality first. This type of problem has a signature requirement ρ \rho ρ as part of the input, and we consider all matchings in the generalized soft quota setting that satisfy the signature requirement with respect to the preference optimality under consideration. Let M O P T \mathcal{M}_{OPT} M O P T be the set of all matchings that meet the signature requirement. Let M t c ′ \mathcal{M}'_{tc} M t c ′ (respectively M m c ′ \mathcal{M}'_{mc} M m c ′ ) denote the set of matchings that have a minimum value of total deviation cost (respectively, the minimum value of maximum deviation cost) in M O P T \mathcal{M}_{OPT} M O P T . We define the following problems:
For the maximum deviation cost variants, as well as for the OPT-MIN-TOT-DC problem, we show that our algorithms in the soft quota setting can be extended to solve the analogous problems in the generalized soft quota setting. For the problem OPT-SIGN-MIN-TOT-DC, we are not aware of any hardness or algorithmic results. We show polynomial time algorithms for solving special cases of the problem OPT-SIGN-MIN-TOT-DC.
Minimizing maximum deviation cost
To solve the MIN-MAX-DC type problems in the generalized soft quota setting, namely OPT-MIN-MAX-DC and OPT-SIGN-MIN-MAX-DC, we use a reduction to problems in the fixed quota setting. We describe the algorithms for the notion of rank-maximality.
We begin by presenting a useful observation about an optimal solution to the problem RMM-MIN-MAX-DC.
Observation 8. Let M ∗ M^* M ∗ be an optimal solution to RMM-MIN-MAX-DC, and let C ∗ C^* C ∗ be the optimal maximum deviation cost. Then, there exists a post p p p such that, in M ∗ M^* M ∗ , the lower deviation cost of p p p is exactly equal to C ∗ C^* C ∗ .
Proof: Suppose not. Then the lower deviation cost of every post with respect to M ∗ M^* M ∗ is strictly less than C ∗ C^* C ∗ . Let the maximum lower deviation cost of any post with respect to M ∗ M^* M ∗ be C ′ C' C ′ . Since d m c ( M ∗ ) = C ∗ d_{mc}(M^*) = C^* d m c ( M ∗ ) = C ∗ , there exists at least one post p ∈ P p \in\mathcal{P} p ∈ P whose upper deviation cost is C ∗ C^* C ∗ . Let P u \mathcal{P}_u P u denote the set of posts that deviate from their upper target with respect to M ∗ M^* M ∗ such that
∣ M ∗ ( p ) ∣ > u ( p ) + ⌈ C ′ c u ( p ) ⌉ . (1) |M^*(p)| > u(p) + \left\lceil\frac{C'}{c_u(p)} \right\rceil. \tag*{(1)} ∣ M ∗ ( p ) ∣ > u ( p ) + ⌈ c u ( p ) C ′ ⌉ . (1)
We construct a matching M ′ M' M ′ from M ∗ M^* M ∗ as follows. For every post p ∈ P u p \in\mathcal{P}_u p ∈ P u , we arbitrarily select ∣ M ∗ ( p ) ∣ − u ( p ) − ⌊ C ′ c u ( p ) ⌋ \lvert M^*(p)\rvert-u(p)-\left\lfloor\frac{C'}{c_u(p)}\right\rfloor ∣ M ∗ ( p )∣ − u ( p ) − ⌊ c u ( p ) C ′ ⌋ matched edges incident on p p p and delete them. We retain all other matched edges in M ∗ M^* M ∗ . Let the resulting matching be M ′ M' M ′ . Observe that, for any post p p p , the upper deviation cost with respect to M ′ M' M ′ is at most C ′ C' C ′ . Since we retained all the matched edges incident on a post p ∉ P u p \notin\mathcal{P}_u p ∈ / P u in M ′ M' M ′ , the lower deviation cost of p p p with respect to M ′ M' M ′ is also at most C ′ C' C ′ . Thus, d m c ( M ′ ) = C ′ < C ∗ d_{mc}(M')=C'<C^* d m c ( M ′ ) = C ′ < C ∗ , which contradicts the fact that M ∗ M^* M ∗ is a matching with minimum maximum deviation cost.
Next, we describe the reduction from generalized soft quota setting to the fixed quota setting.
Reduction from generalized soft quota setting to the fixed quota setting. Given an instance G G G of the generalized soft quota setting, and a fixed value of cost C C C , we construct a fixed quota setting instance H C H_C H C as follows. In H C H_C H C , the applicants, posts, and applicant preferences remain the same as those of G G G . For a post p p p , we set the lower quota as q − ( p ) = max { 0 , ℓ ( p ) − ⌊ C c ℓ ( p ) ⌋ } q^-(p)=\max\{0,\ell(p)-\left\lfloor\frac{C}{c_\ell(p)}\right\rfloor\} q − ( p ) = max { 0 , ℓ ( p ) − ⌊ c ℓ ( p ) C ⌋ } , and the upper quota as q + ( p ) = u ( p ) + ⌊ C c u ( p ) ⌋ q^+(p)=u(p)+\left\lfloor\frac{C}{c_u(p)}\right\rfloor q + ( p ) = u ( p ) + ⌊ c u ( p ) C ⌋ . Note that if H C H_C H C admits a feasible matching, then the same matching is feasible for a fixed quota setting instance H C ′ H_{C'} H C ′ for any cost C ′ ≥ C C'\ge C C ′ ≥ C . This is because an increase in the cost widens the range of acceptable numbers of applicants for a post.
Let C ℓ ∗ = max p ∈ P c ℓ ( p ) C_\ell^*=\max_{p\in\mathcal{P}}c_\ell(p) C ℓ ∗ = max p ∈ P c ℓ ( p ) and C u ∗ = max p ∈ P c u ( p ) C_u^*=\max_{p\in\mathcal{P}}c_u(p) C u ∗ = max p ∈ P c u ( p ) . Next, we present the algorithms for RMM-MIN-MAX-DC and RMM-SIGN-MIN-MAX-DC.
Algorithm for RMM-MIN-MAX-DC. Given an instance G G G of the generalized soft quota setting, our goal is to compute a rank-maximal matching among all matchings that have a minimum value of maximum deviation cost. Under the assumption about ℓ ( p ) \ell(p) ℓ ( p ) , the maximum deviation of any post is upper bounded by ∣ A ∣ \lvert\mathcal{A}\rvert ∣ A ∣ . From Observation 8, the maximum deviation cost of any matching is upper bounded by ∣ A ∣ ⋅ C ℓ ∗ \lvert\mathcal{A}\rvert\cdot C_\ell^* ∣ A ∣ ⋅ C ℓ ∗ . Therefore, the maximum deviation cost of any matching lies in the range [ 0 , ∣ A ∣ ⋅ C ℓ ∗ ] [0,\lvert\mathcal{A}\rvert\cdot C_\ell^*] [ 0 , ∣ A ∣ ⋅ C ℓ ∗ ] . To compute the minimum value of maximum deviation cost, we start by guessing the maximum deviation cost value C C C and checking whether the corresponding fixed quota setting instance H C H_C H C admits a feasible matching. To check feasibility, we can ignore the preferences and use the standard flow network for the bipartite matching with demands on the edges. We perform a binary search on C C C in the range [ 0 , ∣ A ∣ ⋅ C ℓ ∗ ] [0,\lvert\mathcal{A}\rvert\cdot C_\ell^*] [ 0 , ∣ A ∣ ⋅ C ℓ ∗ ] to compute the smallest C C C such that there exists a feasible solution. Let C ∗ C^* C ∗ be the minimum value of C C C obtained. Then, corresponding to C ∗ C^* C ∗ , we compute rank-maximal matching among all feasible matchings (RMM-LQ) in the fixed quota setting instance H C ∗ H_{C^*} H C ∗ . By the definition of RMM-LQ, the resulting matching has the best possible signature with respect to the notion of rank-maximality while achieving the minimum value for the maximum deviation cost.
Algorithm for RMM-SIGN-MIN-MAX-DC. Given an instance G G G of the generalized soft quota setting and an input signature ρ \rho ρ , our goal is to compute a matching M M M in M R \mathcal{M}_{\mathcal{R}} M R (recall that M R \mathcal{M}_{\mathcal{R}} M R is the set of matchings whose signatures are at least as good as ρ \rho ρ with respect to rank-maximality) that has a minimum value of maximum deviation cost. Under the assumption about ℓ ( p ) \ell(p) ℓ ( p ) , lower deviation of any post is upper bounded by ∣ A ∣ \lvert\mathcal{A}\rvert ∣ A ∣ . Similarly, the upper deviation of any post is upper bounded by ∣ A ∣ \lvert\mathcal{A}\rvert ∣ A ∣ . Therefore, the maximum deviation cost of any matching lies in the range [ 0 , ∣ A ∣ ⋅ max { C ℓ ∗ , C u ∗ } ] [0,\lvert\mathcal{A}\rvert\cdot\max\{C_\ell^*,C_u^*\}] [ 0 , ∣ A ∣ ⋅ max { C ℓ ∗ , C u ∗ }] . To compute the minimum value of maximum deviation cost for a matching in M R \mathcal{M}_{\mathcal{R}} M R , we start by guessing the maximum deviation cost value C C C and check whether the corresponding fixed quota setting instance H C H_C H C admits a feasible matching. If the instance $H_C pitsaaner?_ admits a feasible matching, we compute a rank-maximal matching M M M (RMM-LQ) among all feasible matchings in H C H_C H C . If σ ( M ) ⪰ R ρ \sigma(M) \succeq_R \rho σ ( M ) ⪰ R ρ , then M M M satisfies the signature requirement with respect to rank-maximality. We perform a binary search on C C C in the range [ 0 , ∣ A ∣ ⋅ ( max { C u ∗ , C u ∗ } ) ] [0,|\mathcal{A}| \cdot(\max\{C_u^*, C_u^*\})] [ 0 , ∣ A ∣ ⋅ ( max { C u ∗ , C u ∗ })] to compute the smallest C C C such that there exists a matching that meets the signature requirement.
Algorithm for RMM-MIN-TOT-DC
Given an instance G G G of the generalized soft quota setting, our goal is to compute a rank-maximal matching among all matchings having the minimum value of total deviation cost. We observe that in an optimal matching M ∗ M^* M ∗ , no post incurs a deviation cost on the upper target.
For a given instance G G G of the generalized soft quota setting, let G x G_x G x denote the corresponding fixed quota setting instance, where for a post p p p , we set the lower quota q − ( p ) = 0 q^-(p)=0 q − ( p ) = 0 and upper quota q + ( p ) = u ( p ) q^+(p)=u(p) q + ( p ) = u ( p ) . Let G ′ G' G ′ be the generalized soft quota setting instance obtained from G G G , where for every post p p p , we restrict ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) \ell'(p)=u'(p)=\ell(p) ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) . Recall that in the case of uniform costs for all posts, any maximum matching in G x ′ G'_x G x ′ is a minimum total deviation matching in G ′ G' G ′ by Lemma 4. However, the analogous claim need not be true in the generalized soft quota setting, as illustrated in the following example.
An instance G G G of generalized soft quota setting with two applicants { a 1 , a 2 } \{a_1,a_2\} { a 1 , a 2 } and two posts { p 1 , p 2 } \{p_1,p_2\} { p 1 , p 2 } is given in Figure 7 . The edge set of G G G forms a complete bipartite graph, as shown in Figure 7 (i). The applicant preferences are shown in Figure 7 (i); however, they are not needed for the illustration. Each post in G G G has four values – lower target, upper target, lower deviation cost and the upper deviation cost as shown in Figure 7 (ii). While the upper deviation cost values y y y and y ′ y' y ′ can take any non-zero integer values, they are not required for the illustration. Since, for every post p p p , we have ℓ ( p ) = u ( p ) \ell(p)=u(p) ℓ ( p ) = u ( p ) in G G G , it follows that G = G ′ G=G' G = G ′ . Consider the matchings M 1 M_1 M 1 and M 2 M_2 M 2 in G ′ G' G ′ , along with their respective total deviation costs, as given in Figure 7 (iii). Both M 1 M_1 M 1 and M 2 M_2 M 2 are maximum matchings in the corresponding fixed quota setting instance G x ′ G'_x G x ′ . Although the deviations of both the matchings are the same, their deviation costs are different.
Figure 7. An instance G G G of generalized soft quota setting with two applicants and two posts. Figure Figure 7 (i) shows the edge set of G G G . Each post has four values – lower target, upper target, lower deviation cost and the upper deviation cost as shown in Figure Figure 7 (ii). Two matchings M 1 M_1 M 1 and M 2 M_2 M 2 in G G G are shown in Figure Figure 7 (iii) along with their total deviation cost.
Recall that in the soft quota setting, the minimum values of total deviation in G ′ G' G ′ and G G G are the same, as established in Lemma 5. Using the same arguments, we obtain an analogous result in the generalized soft quota setting stated as Lemma 14.
Lemma 14. Minimum value of total deviation cost in G ′ G' G ′ and G G G is the same.
As illustrated by the example in Figure 7 , the approach in § 4.1 cannot be applied directly, and we propose the following modification. To compute a RMM-MIN-TOT-DC matching in G G G , our idea is the following.
We construct an instance G ′ G' G ′ from G G G , where for every post p p p , ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) \ell'(p)=u'(p)=\ell(p) ℓ ′ ( p ) = u ′ ( p ) = ℓ ( p ) . While the construction of G ′ G' G ′ remains unchanged, we focus on the set of matchings that minimize total deviation cost, and select a rank-maximal matching M M M from this set. Note that M M M is a solution to RMM-MIN-TOT-DC in G ′ G' G ′ .
We augment the matching M M M in the corresponding fixed quota setting instance G x G_x G x (where q − ( p ) = 0 q^{-}(p)=0 q − ( p ) = 0 , and q + ( p ) = u ( p ) q^{+}(p)=u(p) q + ( p ) = u ( p ) ) to obtain an RMM-MIN-TOT-DC matching M ∗ M^* M ∗ in G G G . This procedure is the same as step (B) of the algorithm for the RMM-MIN-TOT problem given in § 4.1 .
Next, we describe the procedure for computing a rank-maximal matching among all matchings with the minimum total deviation cost.
Computing RMM-MIN-TOT-DC in G ′ G' G ′
Given the instance G ′ G' G ′ , we reduce the problem to computing a min-cost max-flow in a suitably designed flow network H H H . A matching M M M corresponding to a min-cost max-flow in H H H has the following two properties:
The construction of the network H H H is similar to that described in step (A) of the algorithm for the RMM-MIN-TOT problem in the soft quota setting, except for the cost assignment on the edges (see § 4.1 for the network description). The costs are assigned as follows:
For an edge ( a , p ) (a,p) ( a , p ) in G ′ G' G ′ of rank i i i , we set cost of the corresponding edge in E A P \mathcal{E}_{AP} E A P to − ( ( n + 1 ) r + ( n + 1 ) r − i ) -((n+1)^r+(n+1)^{r-i}) − (( n + 1 ) r + ( n + 1 ) r − i ) . This cost assignment is the same as that used in the RMM-MIN-TOT problem.
For an edge ( d , p ) (d,p) ( d , p ) in E D P \mathcal{E}_{DP} E D P , we set the cost as ( n + 1 ) r + 1 ⋅ c ℓ ( p ) (n+1)^{r+1}\cdot c_{\ell}(p) ( n + 1 ) r + 1 ⋅ c ℓ ( p ) , where c ℓ ( p ) c_{\ell}(p) c ℓ ( p ) is the corresponding lower deviation cost. Recall that, in the RMM-MIN-TOT problem, we set the cost of these edges as 0.
There is a natural correspondence between a flow f f f in H H H and a matching M M M in G ′ G' G ′ as follows:
M = { ( a , p ) ∣ f ( a , p ) = 1 , ( a , p ) ∈ E A P } . M=\{(a,p)\mid f(a,p)=1,\ (a,p)\in\mathcal{E}_{AP}\}. M = {( a , p ) ∣ f ( a , p ) = 1 , ( a , p ) ∈ E A P } .
Note that, by our construction, a max-flow in H H H has value ∑ p ∈ P ℓ ( p ) \sum_{p\in P}\ell(p) ∑ p ∈ P ℓ ( p ) . We define the total deviation cost of a max-flow f f f , which is different from the total cost c o s t ( f ) cost(f) cos t ( f ) of the max-flow.
Definition 10 (Total deviation cost of a max-flow). Total deviation cost of a max-flow f f f in H H H is defined as
d t c ( f ) = ∑ p ∈ P d f ( p ) ( n + 1 ) r + 1 dtc(f)=\frac{\sum_{p\in P}d_f(p)}{(n+1)^{r+1}} d t c ( f ) = ( n + 1 ) r + 1 ∑ p ∈ P d f ( p )
where d f ( p ) = ∑ d ∈ D p f ( d , p ) ⋅ ( n + 1 ) r + 1 ⋅ c ℓ p d_f(p) = \sum_{d \in D_p} f(d,p) \cdot(n+1)^{r+1} \cdot c_{\ell p} d f ( p ) = ∑ d ∈ D p f ( d , p ) ⋅ ( n + 1 ) r + 1 ⋅ c ℓ p is the total deviation cost via p p p through the dummy applicants.
We now focus on matchings in G ′ G' G ′ that do not deviate from the upper target. Such matchings correspond to feasible matchings in G x ′ G'_x G x ′ . For any matching M M M in G x ′ G'_x G x ′ , we can always construct a max-flow f f f in H H H such that d t c ( M ) = d t c ( f ) d_{tc}(M) = d_{tc}(f) d t c ( M ) = d t c ( f ) . Similarly, for any max-flow f f f in H H H , we can construct a matching M M M in G ′ G' G ′ that does not deviate from the upper target. Therefore, we can restrict our attention to max-flows in H H H .
Cost of a max-flow in H H H and total deviation cost of a matching in G ′ G' G ′ . By the design of our network, we ensure that the cost of a max-flow in H H H corresponds to the total deviation cost of the corresponding matching in G ′ G' G ′ . This is proved in Lemma 15.
Lemma 15. Let f , f ′ f, f' f , f ′ be two max-flows in H H H , and let M f , M f ′ M_f, M_{f'} M f , M f ′ be the corresponding matchings in G ′ G' G ′ . If d t c ( M f ) < d t c ( M f ′ ) d_{tc}(M_f) < d_{tc}(M_{f'}) d t c ( M f ) < d t c ( M f ′ ) , then cost ( f ) < cost ( f ′ ) \operatorname{cost}(f) < \operatorname{cost}(f') cost ( f ) < cost ( f ′ ) .
Proof: For a post p p p , the incoming flow is via edges in E D P \mathcal{E}_{DP} E D P , and E A P \mathcal{E}_{AP} E A P . In H H H , only the edges in E A P \mathcal{E}_{AP} E A P and E D P \mathcal{E}_{DP} E D P have a non-zero cost. Due to the multiplicative factor ( n + 1 ) r + 1 (n+1)^{r+1} ( n + 1 ) r + 1 in the cost of edges in E D P \mathcal{E}_{DP} E D P , and the fact that d t c ( M f ) = d t c ( f ) d_{tc}(M_f) = d_{tc}(f) d t c ( M f ) = d t c ( f ) , the contribution of edges in E D P \mathcal{E}_{DP} E D P to the cost of the flow f f f is d t c ( M f ) ⋅ n r + 1 d_{tc}(M_f) \cdot n^{r+1} d t c ( M f ) ⋅ n r + 1 . Recall the cost of an edge in E A P \mathcal{E}_{AP} E A P . Observe that cost of the flow f f f can be upper bounded by
cost ( f ) ≤ ∣ M f ∣ ( − ( n + 1 ) r ) − ∣ M f ∣ + d t c ( M f ) ⋅ ( n + 1 ) r + 1 . \operatorname{cost}(f) \le|M_f|\left(-(n+1)^r\right)-|M_f|+d_{tc}(M_f)\cdot(n+1)^{r+1}. cost ( f ) ≤ ∣ M f ∣ ( − ( n + 1 ) r ) − ∣ M f ∣ + d t c ( M f ) ⋅ ( n + 1 ) r + 1 .
where the equality is achieved when all edges are of rank r r r . Similarly, the cost of the flow f ′ f' f ′ can be lower bounded by
cost ( f ′ ) ≥ ∣ M f ′ ∣ ( − ( n + 1 ) r ) − ∣ M f ′ ∣ ( ( n + 1 ) r − 1 ) + d t c ( M f ′ ) ⋅ ( n + 1 ) r + 1 . \operatorname{cost}(f') \ge|M_{f'}|\left(-(n+1)^r\right)-|M_{f'}|\left((n+1)^{r-1}\right)+d_{tc}(M_{f'})\cdot(n+1)^{r+1}. cost ( f ′ ) ≥ ∣ M f ′ ∣ ( − ( n + 1 ) r ) − ∣ M f ′ ∣ ( ( n + 1 ) r − 1 ) + d t c ( M f ′ ) ⋅ ( n + 1 ) r + 1 .
where the equality is achieved when all edges are of rank 1.
We show that ∣ M f ∣ ≥ ∣ M f ′ ∣ |M_f| \ge|M_{f'}| ∣ M f ∣ ≥ ∣ M f ′ ∣ . Suppose, for the sake of contradiction, assume that ∣ M f ∣ < ∣ M f ′ ∣ |M_f| < |M_{f'}| ∣ M f ∣ < ∣ M f ′ ∣ . Consider the contribution of edges in E D P \mathcal{E}_{DP} E D P to the costs of the flows f f f and f ′ f' f ′ . Observe that there are ∑ p ∈ P ℓ ( p ) − ∣ M f ∣ \sum_{p \in\mathcal{P}} \ell(p)-|M_f| ∑ p ∈ P ℓ ( p ) − ∣ M f ∣ terms with a coefficient of ( n + 1 ) r + 1 (n+1)^{r+1} ( n + 1 ) r + 1 in d t c ( M f ) ⋅ ( n + 1 ) r + 1 d_{tc}(M_f)\cdot(n+1)^{r+1} d t c ( M f ) ⋅ ( n + 1 ) r + 1 . Similarly, there are ∑ p ∈ P ℓ ( p ) − ∣ M f ′ ∣ \sum_{p \in\mathcal{P}} \ell(p)-|M_{f'}| ∑ p ∈ P ℓ ( p ) − ∣ M f ′ ∣ terms with a coefficient of ( n + 1 ) r + 1 (n+1)^{r+1} ( n + 1 ) r + 1 in d t c ( M f ′ ) ⋅ ( n + 1 ) r + 1 d_{tc}(M_{f'})\cdot(n+1)^{r+1} d t c ( M f ′ ) ⋅ ( n + 1 ) r + 1 . Since ∣ M f ∣ < ∣ M f ′ ∣ |M_f| < |M_{f'}| ∣ M f ∣ < ∣ M f ′ ∣ , we have d t c ( M f ) ⋅ ( n + 1 ) r + 1 > d t c ( M f ′ ) ⋅ ( n + 1 ) r + 1 d_{tc}(M_f)\cdot(n+1)^{r+1} > d_{tc}(M_{f'})\cdot(n+1)^{r+1} d t c ( M f ) ⋅ ( n + 1 ) r + 1 > d t c ( M f ′ ) ⋅ ( n + 1 ) r + 1 , which contradicts the fact that d t c ( M f ) < d t c ( M f ′ ) d_{tc}(M_f) < d_{tc}(M_{f'}) d t c ( M f ) < d t c ( M f ′ ) .
Using the facts d t c ( M f ) < d t c ( M f ′ ) d_{tc}(M_f) < d_{tc}(M_{f'}) d t c ( M f ) < d t c ( M f ′ ) , and ∣ M f ∣ ≥ ∣ M f ′ ∣ |M_f| \ge|M_{f'}| ∣ M f ∣ ≥ ∣ M f ′ ∣ , together with the same arguments as in the proof of Lemma 6, we conclude that cost ( f ) < cost ( f ′ ) \operatorname{cost}(f) < \operatorname{cost}(f') cost ( f ) < cost ( f ′ ) .
Lemma 16. Let f f f be a min-cost flow in H H H , and let M f M_f M f be a corresponding matching in G ′ G' G ′ . Then M f M_f M f is a matching with minimum total deviation cost in G ′ G' G ′ .
Proof: Suppose not. Let M ∗ M^* M ∗ be a matching with minimum total deviation cost in G ′ G' G ′ , and let f ∗ f^* f ∗ be the corresponding flow. Since d t c ( M ∗ ) < d t c ( M f ) d_{tc}(M^*) < d_{tc}(M_f) d t c ( M ∗ ) < d t c ( M f ) , it follows from Lemma 15 that cost ( f ∗ ) < cost ( f ) \operatorname{cost}(f^*) < \operatorname{cost}(f) cost ( f ∗ ) < cost ( f ) , which contradicts the fact that f f f is a min-cost flow.
Given the connection between the total deviation cost of G G G and G ′ G' G ′ established in Lemma 14 , which is independent of the preferences, we know that the minimum total deviation cost in G G G is equal to that in G ′ G' G ′ . This leads to the following corollary.
Corollary 2. Any min-cost max-flow in H H H corresponds to a matching with minimum total deviation cost in G G G .
We now prove the preference optimality of the matching obtained by step (A).
Lemma 17. Any min-cost max-flow in H H H corresponds to a solution to the RMM-MIN-TOT-DC problem in G ′ G' G ′ .
Proof of Lemma 17 is a direct generalization of the proof of Lemma 8.
In step (A), we have computed a matching M M M that is a solution to RMM-MIN-TOT-DC problem in G ′ G' G ′ . Using careful augmentations, as described in the Step (B) of the RMM-MIN-TOT problem in the soft quota setting, we can compute a rank-maximal matching among all matchings with minimum total deviation cost in G G G .
Special case of RMM-SIGN-MIN-TOT-DC
Given an instance G G G of the generalized soft quota setting and an input signature ρ \rho ρ , our goal is to compute a matching that satisfies the signature requirement and has a minimum value of the total deviation cost. For the general case of this problem, we are not aware of any efficient algorithm. As a starting point, we first consider a simpler scenario in which all posts have the same lower deviation cost c ℓ c_\ell c ℓ and the same upper deviation cost c u c_u c u . By modifying the network given in Figure 3 , we can solve this problem efficiently. We then extend this approach to a special case, where posts are divided into a constant number of partitions, with each partition having a uniform lower and upper deviation cost across all its posts. We provide an efficient algorithm for this case, which we describe below.
We consider the case of the RMM-SIGN-MIN-TOT-DC problem, where posts in P \mathcal{P} P are partitioned into P 1 ∪ P 2 ∪ … ∪ P k \mathcal{P}_1 \cup\mathcal{P}_2 \cup\ldots\cup\mathcal{P}_k P 1 ∪ P 2 ∪ … ∪ P k . For each post p ∈ P i p \in\mathcal{P}_i p ∈ P i , the cost per lower deviation is x i x_i x i , and the cost per upper deviation is y i y_i y i . To solve the RMM-SIGN-MIN-TOT-DC problem in this case, we modify the flow network in Figure 3 as follows.
We remove all the outgoing edges from d ′ d' d ′ , and introduce nodes d i ′ d'_i d i ′ , i ∈ [ k ] i \in[k] i ∈ [ k ] . We add an edge from d ′ d' d ′ to d i ′ d'_i d i ′ with vector [ l d i , l d i ] [ld_i,ld_i] [ l d i , l d i ] (demand and capacity).
For each i ∈ [ k ] i \in[k] i ∈ [ k ] , we add an edge from d i ′ d'_i d i ′ to every post p ′ p' p ′ such that p ∈ P i p \in\mathcal{P}_i p ∈ P i , with vector [ 0 , l d i ] [0,ld_i] [ 0 , l d i ] .
We remove all incoming edges to d ′ ′ d'' d ′′ , and introduce nodes d i ′ ′ d''_i d i ′′ , for i ∈ [ k ] i \in[k] i ∈ [ k ] . We add an edge from d i ′ ′ d''_i d i ′′ to d ′ ′ d'' d ′′ with vector [ u d i , u d i ] [ud_i,ud_i] [ u d i , u d i ] .
For each i ∈ [ k ] i \in[k] i ∈ [ k ] , we add an edge from p ′ ′ p'' p ′′ to d i ′ ′ d''_i d i ′′ , for p ∈ P i p \in\mathcal{P}_i p ∈ P i , with vector [ 0 , u d i ] [0,ud_i] [ 0 , u d i ] .
In this network, for each i ∈ [ k ] i \in[k] i ∈ [ k ] , the values l d i ld_i l d i and u d i ud_i u d i represent the total lower deviation and the total upper deviation, respectively, for all posts in the partition P i \mathcal{P}_i P i . A min-cost max-flow in this modified network corresponds to a rank-maximal matching in which the total lower and upper deviations for each partition are fixed by the values { ( l d i , u d i ) } 1 ≤ i ≤ k \{(ld_i,ud_i)\}_{1\leq i\leq k} {( l d i , u d i ) } 1 ≤ i ≤ k .
Observe that, for a given i ∈ [ k ] i \in[k] i ∈ [ k ] , the total deviation of all posts in P i \mathcal{P}_i P i is at most ∣ A ∣ ⋅ ∣ P i ∣ |\mathcal{A}| \cdot|\mathcal{P}_i| ∣ A ∣ ⋅ ∣ P i ∣ . Thus, the total number of possible values for ( l d i , u d i ) (ld_i,ud_i) ( l d i , u d i ) is at most ( ∣ A ∣ ⋅ ∣ P i ∣ + 1 ) 2 (|\mathcal{A}| \cdot|\mathcal{P}_i|+1)^2 ( ∣ A ∣ ⋅ ∣ P i ∣ + 1 ) 2 . Consequently, the total number of possible combinations of deviations { ( l d i , u d i ) } 1 ≤ i ≤ k \{(ld_i,ud_i)\}_{1\leq i\leq k} {( l d i , u d i ) } 1 ≤ i ≤ k is O ( n 4 k ) O(n^{4k}) O ( n 4 k ) (assuming that ∣ A ∣ = O ( ∣ P ∣ ) |\mathcal{A}|=O(|\mathcal{P}|) ∣ A ∣ = O ( ∣ P ∣ ) ). Each such combination corresponds to a specific network, and for each network, if it admits a feasible flow, then we compute a rank-maximal matching, say M M M , among all feasible matchings. If σ ( M ) ⪰ R ρ \sigma(M) \succeq_R \rho σ ( M ) ⪰ R ρ , then M M M is a candidate solution. By iterating through all combinations, we compute a solution that satisfies the signature requirement and has the minimum total deviation cost. The time complexity of the algorithm is O ( n 4 k ⋅ T ( n ) ) O(n^{4k} \cdot T(n)) O ( n 4 k ⋅ T ( n )) , where T ( n ) T(n) T ( n ) is the time taken to solve the min-cost max-flow problem.
Discussion
In this work, we study the problem of computing optimal matchings with one-sided preferences in the soft quota setting. We consider two orthogonal optimization parameters, namely the deviation of the matching and preference optimality. For the preference optimality notions of rank-maximality and fairness, we present efficient algorithms. Our algorithms rely on exponential weights on the edges of the flow network. It would be interesting to design algorithms that do not need large weights.
We also explore a natural generalization of the soft quota setting, where every deviation is associated with a cost. In this generalized soft quota setting, we present efficient algorithms for rank-maximality and fairness when the objective is to optimize the maximum deviation cost. For minimizing total deviation cost, we provide an efficient algorithm for the case where no signature requirement is imposed. However, when a signature requirement is imposed, we are not aware of any hardness or algorithmic results for minimizing total deviation cost, leaving it as an open problem.
Acknowledgements
We thank Govind S Sankar for his valuable contributions and insightful discussions that greatly assisted us in the initial stages of this work.
Appendix
Lemma 3. Let M , M ′ M, M' M , M ′ be matchings such that σ ( M ) ≻ F σ ( M ′ ) \sigma(M) \succ_{\mathcal{F}} \sigma(M') σ ( M ) ≻ F σ ( M ′ ) . Then, cost ( M ) < cost ( M ′ ) \operatorname{cost}(M) < \operatorname{cost}(M') cost ( M ) < cost ( M ′ ) , where each rank i i i edge has a cost of ( n + 1 ) i (n+1)^i ( n + 1 ) i , and every unmatched applicant is treated as being matched to a dummy post of rank r + 1 r+1 r + 1 with cost ( n + 1 ) r + 1 (n+1)^{r+1} ( n + 1 ) r + 1 .
Proof: Let σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) \sigma(M) = (x_1, x_2, \ldots, x_r, x_{r+1}) σ ( M ) = ( x 1 , x 2 , … , x r , x r + 1 ) , and σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) \sigma(M') = (y_1, y_2, \ldots, y_r, y_{r+1}) σ ( M ′ ) = ( y 1 , y 2 , … , y r , y r + 1 ) . Let i i i be the first rank at which σ ( M ) \sigma(M) σ ( M ) and σ ( M ′ ) \sigma(M') σ ( M ′ ) differ. Thus, x j = y j x_j = y_j x j = y j for all j > i j > i j > i , and x i < y i x_i < y_i x i < y i .
The cost difference between the matchings M M M and M ′ M' M ′ is
cost ( M ′ ) − cost ( M ) = ∑ j = 1 r + 1 ( y j − x j ) ( n + 1 ) j = ( y i − x i ) ( n + 1 ) i + ∑ j = 1 i − 1 ( y j − x j ) ( n + 1 ) j . \operatorname{cost}(M') - \operatorname{cost}(M) = \sum_{j=1}^{r+1}(y_j-x_j)(n+1)^j = (y_i-x_i)(n+1)^i + \sum_{j=1}^{i-1}(y_j-x_j)(n+1)^j. cost ( M ′ ) − cost ( M ) = j = 1 ∑ r + 1 ( y j − x j ) ( n + 1 ) j = ( y i − x i ) ( n + 1 ) i + j = 1 ∑ i − 1 ( y j − x j ) ( n + 1 ) j .
Now, since y i − x i ≥ 1 y_i-x_i \ge1 y i − x i ≥ 1 , we have
cost ( M ′ ) − cost ( M ) ≥ ( n + 1 ) i + ∑ j = 1 i − 1 ( y j − x j ) ( n + 1 ) j ≥ ( n + 1 ) i − ∑ j = 1 i − 1 x j ( n + 1 ) j ≥ ( n + 1 ) i − ( ∑ j = 1 i − 1 x j ) ( n + 1 ) i − 1 . \begin{aligned}
\operatorname{cost}(M')-\operatorname{cost}(M) \ge(n+1)^i+\sum_{j=1}^{i-1}(y_j-x_j)(n+1)^j \\
&\ge(n+1)^i-\sum_{j=1}^{i-1}x_j(n+1)^j \\
&\ge(n+1)^i-\left(\sum_{j=1}^{i-1}x_j\right)(n+1)^{i-1}.
\end{aligned} cost ( M ′ ) − cost ( M ) ≥ ( n + 1 ) i + j = 1 ∑ i − 1 ( y j − x j ) ( n + 1 ) j ≥ ( n + 1 ) i − j = 1 ∑ i − 1 x j ( n + 1 ) j ≥ ( n + 1 ) i − ( j = 1 ∑ i − 1 x j ) ( n + 1 ) i − 1 .
Additionally, using the fact that ∑ j = 1 i − 1 x j ≤ ∑ j = 1 r + 1 x j = n \sum_{j=1}^{i-1}x_j \le\sum_{j=1}^{r+1}x_j=n ∑ j = 1 i − 1 x j ≤ ∑ j = 1 r + 1 x j = n , we conclude that
cost ( M ′ ) − cost ( M ) ≥ ( n + 1 ) i − n ( n + 1 ) i − 1 = ( n + 1 ) i − 1 > 0. \operatorname{cost}(M')-\operatorname{cost}(M) \ge(n+1)^i-n(n+1)^{i-1}=(n+1)^{i-1}>0. cost ( M ′ ) − cost ( M ) ≥ ( n + 1 ) i − n ( n + 1 ) i − 1 = ( n + 1 ) i − 1 > 0.
□ \square □