• No se han encontrado resultados

JUZGADO CUARTO DE LO CIVIL DEL PRIMER DEPARTAMENTO JUDICIAL DEL ESTADO

Theorem 4.7.1 Let I be a (2,∞)-SESM (or (∞, 2)-SESM) instance. Then, a sex-equal stable matching forI can be found in polynomial-time.

4.8

An exact algorithm for

(l,∞)-SESM

4.8.1 The structure of DΠ

Properties of

In this section we describe an exact exponential-time algorithm for SESM when the men’s pref- erence lists are bounded in length by a constant l≥ 3 (if l ≤ 2 then we can solve the problem in

polynomial time). Our method hinges on the observation that when the number of rotations in the rotation digraphDΠis at most(5−√24)(l− 2)n (the reason for this particular factor of n becomes

apparent later on), a brute-force algorithm that enumerates all subsets of the vertices ofDΠsuffices

to find a SESM. Otherwise, if the number of rotations exceeds that factor ofn, we prove that GΠ

must have bounded average degree. This allows us to use existing results concerning graphs with bounded average degree to design a moderately exponential time algorithm. In particular, we will apply the following theorem, which is due to Edwards and Farr [25], toGΠ.

Theorem 4.8.1 (Edwards and Farr [25]). LetG be an undirected graph with n vertices and m edges of average degreed≥ 4, or a connected graph of average degree d ≥ 2. Then, in O(nm) time, a series-parallel induced subgraphP of G can be found such that|P | ≥ 3n/(d + 1). Hence, ifN = G− P , then |N| ≤ (d − 2)n/(d + 1).

To see how this theorem may be used we will establish several key properties regardingDΠ. We

establish a few bounds on the number of vertices and edges inGΠ in terms of the number n of

agents of the instance, the lengthsl of the men’s preference lists, and the number r of rotations in DΠ. We begin by bounding from above the number of rotations, i.e. the number of vertices inDΠ,

and the number of edges inDΠ.

Lemma 4.8.1 LetI be an (l,∞)-SMI instance, and DΠ its rotation digraph. Then,contains

4.8 An exact algorithm for(l, ∞)-SESM 67

Proof Any mutually acceptable (man,woman) pair can appear as a pair in at most one rotation in

DΠ, except for a pair(m, w) such that w is ranked last on m’s preference list, which cannot appear

in any rotation. A rotation must always have at least two (man,woman) pairs. It follows that each rotation accounts for at least two distinct (man,woman) pairs, and the woman in such a pair may not be last on the man’s preference list. Since there aren/2 men, (l− 1)n/4 is an upper bound on

the number of rotations. 2

Lemma 4.8.2 LetI be an (l,∞)-SMI instance, and DΠits rotation digraph. Then, the number of

edges ofis at most(l− 2)n/2.

Proof Consider any edgee = (ρ′, ρ)∈ DΠ. Ifρ′ is a type-1 predecessor ofρ (and possibly also a

type-2 predecessor), then by definition there exists a pair(mi, wi) in ρ such that the elimination of

ρ′matchesmitowi. Notice thatwican neither bemi’s first or last choice. If insteadρ′is a type-2

predecessor ofρ, then there is a pair (mi, wi) in ρ such that ρ moves mi below a womanw 6= wi

andρ′ is the unique rotation that movesw above mi. Notice in this case as well,w cannot be the

first or last choice ofm′.

Therefore, for every edge ofDΠwe are able to identify a distinct (man,woman) pair(m, w) such

thatw is neither m’s first nor last choice. Hence the number of edges of DΠis bounded above by

(l− 2)n/2. 2

Recall that our ultimate goal is to apply Theorem 4.8.1 to GΠ in a particular way as a part of

the algorithm of this section. But, notice that Theorem 4.8.1 does not apply to graphs that are disconnected and have average degree less than 4. We will find it useful later on to know that we can connectGΠas described in the following lemma.

Lemma 4.8.3 LetG be a graph with c components and m > 0 edges. Then by adding a single vertex andc + 1 edges to G a new connected graph Gmay be formed with average degree≥ 2.

Proof Suppose thatG has r vertices, so that m ≥ r − c. Add a new vertex v together with an

edge connectingv to a vertex in each component of G, and a second edge connecting v to a second

4.8 An exact algorithm for(l, ∞)-SESM 68 Then the new graphG′ is connected, hasr= r + 1 vertices, m= m + c + 1 edges, and average

degree d′ = 2m′ r′ = 2(m + c + 1) r + 1 ≥ 2(r + 1) r + 1 ≥ 2. 2

Dealing with small components

The algorithm we describe in the forthcoming sections will rely on the fact thatGΠhas no compo-

nents withc vertices or fewer, where c is a fixed constant independent of the size of the input. In

what follows we will show that we can use dynamic programming to preprocess the constant-sized components ofGΠin polynomial-time, allowing to make the assumption that no such components

are present inGΠ.

LetQ = Q1, . . . Qt be the components ofGΠ with at mostc0 vertices, where c0 is an arbitrary

constant. For each Qi, construct a binary vector Xi, whose jth component is 1 if and only if

there exists a closed subset ofΠ[Ci] with weight exactly j (recall Π[Ci] is the partially ordered set

induced byCi). The length of this vector is polynomially bounded (for example, the sum of the

weights of all of the rotations inΠ suffices). Since Qihas constant size, computing this vector takes

polynomial-time.

The next step is to compute a sequence of combined binary vectorsYksuch that thejth component

ofYk is 1 if and only if there exists a closed subset ofQ1 ∪ . . . ∪ Qk with weight exactlyj. To

begin, setY1 = X1. Suppose now thatYi is known for somei (1 ≤ i < t). We compute the jth

entry ofYi+1(denotedYi+1j ) by the following formula:

Yi+1j = Yij

j

_

l=0

(Yil∧ Xi+1j−l).

Hence the non-zero components ofYtare exactly the weights attainable by the closed subsets ofQ.

The setQ may now be discarded from GΠ, giving a new graphG′Π.

This procedure is invoked in the step labeled by (1) in the pseudocode description of the algorithm in Figure 4.2. The vector Yt is stored and used later (specifically, in Section 4.9) when a closed

4.8 An exact algorithm for(l, ∞)-SESM 69

4.8.2 The algorithm

Algorithm idea

The general idea of the algorithm is the following. IfΠ contains sufficiently few rotations, the

algorithm finds a sex-equal stable matching by brute force. Otherwise, we use Theorem 4.8.1 to partitionGΠinto two parts,N and P , where P is a series-parallel graph (defined in Section 4.3) and

the size ofN is bounded. The algorithm then decides which rotations from N should be eliminated

by explicitly trying all subsetsN′ ofN . Notice of course that at least one such subset is a maximal

subset ofN that is contained in an optimal closed subset of Π. For a fixed subset of N′, it may be that there existsρ ∈ N − N′ such that, inDΠ,ρ precedes some ρ′ ∈ N′, in which case we may

immediately rejectN′. Otherwise, ifN′ is valid in this sense, then some rotations fromP , namely

those that precede a rotation inN′, are forced also to be eliminated. Other rotations, namely those with a predecessor inN− N′cannot be eliminated and are forbidden for this choice ofN. Notice

that sinceN′is valid, the sets of forced and forbidden rotations are disjoint. All other rotations inP

are neither forced nor forbidden. Our goal is to find a subsetP′∪ Q′such thatP⊆ P and Q⊆ Q

(recallQ is the set of components of size at most c0) such thatP′∪ Q′extendsN′optimally in the

following way:

(i)N′∪ P∪ Qis a closed subset ofΠ. Note that this is equivalent to saying that Pincludes every

forced rotation and no forbidden rotations, andQ′is a closed subset ofQ.

(ii)N′∪ P∪ Qis an optimal extension ofNi.e. P∪ Qminimizesδ(N∪ P∪ Q) over all

choices ofP′ andQ′ that satisfy (i).

In Section 4.9 we will show that a choice ofP′∪ Qthat satisfies the above criteria can be found

in polynomial time. Hence the running time of the algorithm will be within a polynomial factor of

2|N|. We next describe the algorithm in detail.

Formal description of the algorithm

The algorithm, which is outlined in Figure 4.2, takes as input an(l,∞)-SMI instance. It consists of