• Aucun résultat trouvé

Minimization in Independence Systems

Dans le document Algorithms and Computation in Mathematics • (Page 166-170)

The Greedy Algorithm

Exercise 5.2.17 Show that the set C of circuits of a matroid (E, S) actu- actu-ally satisfies the following stronger version of the circuit axiom (2) in

5.5 Minimization in Independence Systems

In this section we consider the minimization problem for independence sys-tems, that is, the problem of finding a maximal independent set of minimal weight; this turns out to be easy for matroids. We first show that the greedy algorithm actually works for arbitrary weight functions on a matroid.

Theorem 5.5.1 Let M = (E,S) be a matroid, and let w:E→R be any weight function on M. Then the greedy algorithm finds an optimal solution for the problem

(BMAX) determine max

w(B) :B is a basis of M .

Proof By definition, the assertion holds if all weights are nonnegative. Oth-erwise, we put

C= max

−w(e) :e∈E, w(e)<0 and consider the weight functionw:E→R+0 defined by

w(e) =w(e) +C for alle∈E.

Now all bases ofM have the same cardinality, sayk. LetB be a basis; then the weights w(B) and w(B) differ just by the constant kC. In particular, every basis of maximal weight forw also has maximal weight for w. Hence we may use the greedy algorithm to find a basisB0 of maximal weight for w which is also a solution for the original problem (BMAX). Obviously, the greedy algorithm runs for w exactly as for w; hence it yields the correct solutionB0 also when applied to the original functionw.

Theorem 5.5.2 Let M = (E,S) be a matroid, and let w:E→R be any weight function on M. Then the greedy algorithm finds an optimal solution for the problem

(BMIN) determine min

w(B) :B is a basis ofM , provided that step(1) in Algorithm5.1.1is replaced as follows:

(1) order the elements of E according to their weight: E={e1, . . . , em} withw(e1)≤w(e2)≤ · · · ≤w(em).

154 5 The Greedy Algorithm

Proof This follows immediately from Theorem5.5.1by considering the weight

function−winstead ofw.

As an application, we investigate the behavior of the greedy algorithm in the context of duality. Suppose we are given a matroidM= (E,S) and a weight functionw:E→R+0. Obviously, a basisBofM has maximal weight if and only if the corresponding cobasisB=B\E ofMhas minimal weight.

Now we use the greedy algorithm, modified as described in Theorem5.5.2, to determine a basisBofMwith minimal weight. Consider the moment when we investigate the elementek. Thenek is added to the current solution—that is, the independent subset T constructed so far—if and only if T∪ {ek} is independent in M. Viewing this situation within M, we may as well say that ek is removed from the current solution T=E\T, as the (final) solution of the maximization problem forM is precisely the complement of the solution of the minimization problem forM. These considerations lead to the followingdual version of the greedy algorithm, formulated in terms of theprimal matroidM.

Algorithm 5.5.3(Dual greedy algorithm) Let (E,S) be a matroid, and let w:E→R+0 be a weight function.

Procedure DUALGREEDY(G, w;T)

(1) order the elements ofE according to their weight:

E={e1, . . . , em}withw(e1)≤w(e2)≤ · · · ≤w(em);

(2) T←E;

(3) for k= 1 tomdo

(4) if(E\T)∪ {ek} does not contain a cocircuit (5) thenremoveek from T

(6)

(7) od

Note that the condition in step (4) is satisfied if and only ifT∪ {ek}= (E\T)∪ {ek} is independent in M; hence the correctness of the greedy algorithm immediately implies the following theorem.

Theorem 5.5.4 Let M = (E,S) be a matroid, and let w:E R+0 be a nonnegative weight function onM.Then the dual greedy algorithm computes a basisB of M= (E,S)with maximal weight.

Example 5.5.5 LetM=M(G) be a graphic matroid, whereGis connected.

The dual greedy algorithm investigates the edges ofGin the order given by increasing weight. Initially,T=E. When an edgeeis examined, it is removed from the current solutionT if and only if it does not form a cocycle with the edges already removed, that is, if removinge does not disconnect the graph

(E, T). This special case of Algorithm 5.5.3was already treated by Kruskal [Kru56].

In the remainder of this section, we look at the greedy algorithm as a pos-sible approximation method for the problems described in Theorems 5.5.1 and5.5.2when M= (E,S) is an arbitrary independence system, not neces-sarily a matroid. Unfortunately, this will not work well. Even for the max-imization problem, the quotient of the weight of a solution found by the greedy algorithm and the weight of an optimal solution—which we used as a measure for the quality of approximation in Sect.5.4—does not make sense if negative weights occur. Still, there is one positive result: Theorem5.4.2 car-ries over to the case of arbitrary weight functions if we consider the problem (P) of Sect.5.4, that is, if we require not a basis but only an independent set of maximal weight and terminate the greedy algorithm as soon as an element of negative weight would be chosen.

Let us now turn to the question whether there is a performance guarantee for applying the greedy algorithm to the minimization problem

(PMIN) determine min

w(A) :A is a maximal independent set inS , wherew:E→R+0 is a nonnegative weight function. Here the reciprocal quo-tient

g(M) = min

w(T0)

w(Tg):w:E→R+0

should be used for measuring the quality of approximation, where againTg denotes a solution constructed by the greedy algorithm and T0 an optimal solution for (PMIN). Clearly, the matroids are precisely the independence systems withg(M) = 1. Unfortunately, no result analogous to Theorem5.4.2 can be proved; this was first shown in [KorHa78] via a rather trivial series of counterexamples, namely a path of length 2 with various weight functions. We will exhibit a class of considerably more interesting examples due to Reingold and Tarjan [ReiTa81].

Example 5.5.6 Let us denote the complete graph on 2t vertices by Gt= (Vt, Et). For each of these graphs, we define a weight function wt satisfying the triangle inequality as follows. First we choose, for allt≥2, a Hamiltonian cycleCtofGt; fort= 1, we takeC1as the only edge ofG1. We define wton Ct as indicated in Fig.5.2, where the edges not marked explicitly with their weight are understood to have weight 1.

For every edgee=uvinEt\Ct, the weightwt(e) is defined as the distance dt(u, v) in the network (Ct, wt). Since the largest weight occurring in Ct is precisely the sum of the weights of all other edges of Ct (so that w(Ct) = 2·3t1), it is easy to see thatwtindeed satisfies the triangle inequality.

156 5 The Greedy Algorithm

Fig. 5.2 A family of networks

Now putMt= (Et,St), whereStis the set of all matchings ofGt. Thus we consider the problem of finding a maximal matching—that is, a 1-factor—

of minimal weight for (Gt, wt). It is easy to see that the greedy algorithm computes, for the casest= 1,2,3,4 shown in Fig.5.2, the 1-factorsFtdrawn bold there, provided that we order edges of the same weight in a suitable manner; these 1-factors have weight 1, 4, 14, and 46, respectively. In the general case of an arbitrary t, one may show that a 1-factor Ft of Gt of weight

wt(Ft) = 2×3t12t1

results; this formula for the weight of Ft can be derived from the rather obvious recursion

wt+1(Ft+1) = 2wt(Ft)3t1+ 3t,

wherew1(F1) = 1. We leave the details to the reader. On the other hand, there is a 1-factorFt ofGt, fort≥2, of weight 2t1which consists of the edges not drawn bold in Fig.5.2:Ft=Ct\Ft. Thus the quality of the approximation found by the greedy algorithm is only

2t1

2×3t12t1 0 (fort→ ∞).

Example 5.5.6shows that the greedy algorithm may yield an arbitrarily bad solution for (PMIN). By Theorem 5.4.4, the rank quotient of the inde-pendence system (Et,St) formed by the matchings in Gt has value 2 for all t≥2. Hence in the case of minimization, the rank quotient does not guarantee a corresponding quality of approximation—a rather disappointing result.

It was shown in [ReiTa81] that the bound forw(T0)/w(Tg) given in Ex-ample5.5.6is essentially worst possible. Indeed, for any weight function on the complete graphKn satisfying the triangle inequality,

w(Tg)

whereθ=logn−logn. For the rather involved proof, we refer to the original paper.

Determining a 1-factor of minimal weight with respect to a weight func-tionw on a complete graph satisfying the triangle inequality will be a tool for solving the Chinese postman problem in Chap. 14; this problem has in-teresting practical applications—for example, drawing large graphs with a plotter.

Exercise 5.5.7 Show that it is not possible to change the weight functionwt

in Example5.5.6such that the quotientFt/Ftbecomes smaller. Also, for an arbitrary weight function (not necessarily satisfying the triangle inequality), it is not possible to give any measure (as a function ofn) for the quality of a 1-factor in a complete graph found by the greedy algorithm.

Dans le document Algorithms and Computation in Mathematics • (Page 166-170)