A simple exact separation algorithm for 2-matching inequalities Julián Aráoz Simón Bolı́var University∗, Venezuela Technical University of Catalonia†, Spain Elena Fernández Technical University of Catalonia, Spain Oscar Meza‡ Simón Bolı́var University, Venezuela. Abstract In this work we present an exact separation algorithm for the so called 2-matching inequalities, otherwise known as parity or co-circuit inequalities. The algorithm is quite simple since it operates on the tree of min-cuts of the support graph of the solution to separate, relative to an ad hoc capacity vector. The order of this algorithm is O(|V |4 ). 1 Introduction Many problems with binary variables require the parity of vertices. For instance, the 2-matching problem, whose solutions are given by the disjoint union of circuits, as well as different types of routing problems, where solutions are also made of circuits. It is well known that the parity of the vertices can be modelled by means of the so-called parity inequalities, otherwise known as co-circuit or 2-matching inequalities. These inequalities are: x(δ(S) \ F ) ≥ x(F )− | F | +1, ∀F ⊆ δ(S), |F | odd, (1) where S is a subset of vertices and δ(S) denotes its cut-set. Edmonds [5] proved that these inequalities fully characterize the 2-matching polytope, and Grötschel and Holland [8] used them in a cutting plane algorithm for the perfect 2-Matching Problem. Given that the 2-matching problem defines one of the most studied relaxations of the Symmetric Traveling Salesman Problem (STSP), since the late eighties, inequalities (1) have ∗ Retired Professor Dpt. Process and Systems. Visiting Professor Dpt. Statistics and Operation Research. ‡ Retired Professor Dpt. Computation and Information Technology † 1 also been considered for the (STSP) (see, for instance [9, 11] by Grötschel and Padberg, and the work by Padberg and Rinaldi [13]). Inequalities (1) are also facets of the polytope of Eulerian graphs [14] and of the more general polytope of binary matroids [2]. Since the solutions to arc routing problems are given by eulerian graphs, inequalities (1) have also been considered in cutting plane algorithms in the context of arc routing problems. For instance, Belenguer and Benavent [3] have used them for the Capacitated Arc Routing Problem, Aráoz et al. [1] for the Prize Collecting Rural Postman Problem, and Benavent et al. [4] for the Windy Rural Postman Problem with K vehicles. Ghiani and Laporte [6] have considered the particular case when S is a singleton in the context of the Rural Postman Problem. Inequalities (1) can be separated in polynomial time. The basic exact identification procedure is due to Padberg and Rao [12]. Improving and reduction techniques for speeding up the convergence of the exact procedure have been proposed by Padberg and Grötschel [11], Grötschel and Holland [8] and Padberg and Rinaldi [13]. These separation algorithms are quite involved, since they require a) to define an extended ad hoc graph, by applying a labeling procedure to the nodes of the support graph of the vector x∗ to be separated, and, b) to apply the Padberg and Rao algorithm [12] to the extended graph. The size of the ad hoc graph can raise up to |V | + |E| vertices, and 2|E| edges, since it has one additional vertex and one additional edge for each fractional edge (x∗e > 0). Therefore, applying the Padberg and Rao procedure to such a graph results in exact procedures of order O (|V | + |E|)4 (see, for instance, [11]). Recently, Letchford, Reinelt and Theis [10] have proposed an algorithm of order O |V |4 . In this paper we work out the basic steps that give an equivalent O |V |4 separation algorithm for inequalities (1) that we use in our applications. The order reduces to O (|E|), when we consider the subclass of inequalities (1) where sets S are singletons. The algorithm can also be used very easily in a heuristic fashion by just identifying the connected components in the support graph of edges above a given threshold (with respect to the considered capacities). The paper is structured as follows. In Section 2 we introduce the notation and give some preliminary results. Section 3 gives some properties, presents the algorithm and proves its correctness. Finally, Section 4 describes the application of the algorithm to the case where sets S are singletons, the application of the algorithm in a heuristic fashion, and some potential efficiency improvements. 2 Notation and Nomenclature As usual G is an undirected graph with vertex set V , |V | = n, and edge set E, |E| = m. Let S be a non-empty proper subset of V . A cut-set (S : V \ S) is a partition of the vertices V of G into two (nonempty) subsets S, and V \ S. Indistinctively, we will also call cut-set to the set of edges with one end-node in S and the other end-node in V \ S. Such a set is denoted δ(S) = {e ∈ E|e = (u, v), u ∈ S, v ∈ V \S} = δ(V \S). For a singleton we do not use the brackets and we write δ(v) ≡ δ({v}). Also, for S ⊆ V , γ(S) = {e ∈ E|e = (u, v), u, v ∈ S}, denotes the edges with both end-nodes in S. For H ⊂ E, δH (S) = δ(S) ∩ H and γH (S) = γ(S) ∩ H denote the previous sets but referred only to the edges in H. We use the standard compact notation 2 f (A) ≡ P e∈A fe when A ⊆ E, and f is a vector or a function defined on E. For a given vector x∗ , 0 ≤ x∗e ≤ 1, Gx∗ = (V, Ex∗ ), with Ex∗ = {e ∈ E : x∗e > 0} denotes its support graph. Each edge in Ex∗ is assigned a capacity given by he = min{x∗e , 1 − x∗e }. We partition Ex∗ , Ex∗ = E < ∪ E > so that an edge e belongs to E < (resp. E > ) if and only if its capacity is given by x∗e (resp. 1 − x∗e ). Values 0.5 assigned arbitrarily to E < or to E > . We say that a vertex v ∈ V is odd> if and only if |δE > (v)| is odd; otherwise we say that v is even> . By extension, we say that a subset S is odd> if it contains an odd number of vertices labelled odd, i.e. |{v ∈ S : v is odd}| is odd. Lemma 2.1 (a) For S ⊂ V , |δE > (S)| is odd if and only if S is odd> . (b) V is even> . Proof: (a) It is well known that X |δE > (u)| = 2|γE > (S)| + |δE > (S)|. (2) u∈S Obviously, the right hand side of equality (2) is odd iff |δE > (S)| is odd. Let now So = {v ∈ S : v is odd}. Given that X X X |δE > (u)| + |δE > (u)|, |δE > (u)| = u∈S u∈So u∈S\So the left hand side of (2) is odd if and only if |So | is odd, or, equivalently S is odd> . P |δE > (u)| = 2|γE > (S)|, which is even. (b) V is even> since, equality (2) for S = V becomes u∈V 2 3 The separation algorithm. Inequalities (1) can be rewritten as X e∈δ(S)\F xe + X (1 − xe ) ≥ 1, ∀F ⊆ δ(S), |F | odd, (3) e∈F For a given vector x∗ , the separation problem for inequalities (1) is to find S ∗ ⊂ V , F ∗ ⊂ δ(S ∗ ), |F ∗ | odd such that the associated inequality (1) is violated by x∗ , or to prove that no such inequality exists. We next present an exact separation algorithm for inequalities (1) of order O(|V |4 ). 3 Lemma 3.1 Let S be a vertex subset, the following two proprieties hold: (a) When S is odd> then a subset F , |F | odd, that minimizes the value of the left hand side of constraint (1) is given by F = δE > (S). The minimum value of the left hand side of the inequality is then given by h(δ(S)). (b) When S is even> , a subset F ⊆ δ(S), |F | odd, with minimum value of the left hand side of constraint (1) can be obtained as follows. If x∗e1 − (1 − x∗e1 ) < (1 − x∗e2 ) − x∗e2 then F = δE > (S) \ {e1 }, with x∗e1 = min{x∗e : e ∈ δE > (S)}. Otherwise, F = δE > (S) ∪ {e2 }, with e2 such that x∗e2 = max{x∗e : e ∈ δ(S) \ δE > (S)}. The minimum value of the left hand side of the inequality is given by h(δ(S)) + min{x∗e1 − (1 − x∗e1 ), (1 − x∗e2 ) − x∗e2 }. Proof: By definition, the capacity of δ(S) is X h (δ(S)) = x∗e + e∈δ(S)∩E< X (1 − x∗e ) e∈δ(S)∩E> which represents the value of the left hand side of constraint (1) for S and F = δE > (S). Moreover, F = δE > (S) is a subset of δ(S) which minimizes the value of the left hand side of (1), without considering the constraint that |F | odd. This completes the proof of property (a), since by Lemma 2.1 S is odd> iff |F | = |δE > (S)| is odd. Property (b) also holds since when |δE > (S)| is even, the minimum increase in the left hand side of (1) so as to have |F | odd is given by min{x∗e1 − (1 − x∗e1 ), (1 − x∗e2 ) − x∗e2 }. 2 Throughout for a given cut-set (S : V \S), e1 and e2 denote arbitrarily chosen edges such that x∗e1 = min{x∗e : e ∈ δE > (S)} and x∗e2 = max{x∗e : e ∈ δ(S) \ δE > (S)}. Lemma 3.1 indicates that for a given vector x∗ , the smallest value of the left hand side in constraint (1) may correspond i) to an odd> set S with F = δE > (S), or ii) to an even> set S, with a modified set F defined as indicated in Lemma 3.1(b). Hence, in order to solve the separation problem for a given vector x∗ we must identify both the odd> set S with minimum capacity h(δ(S)), and the even> set S that minimizes h(δ(S)) + min{x∗e1 − (1 − x∗e1 ), (1 − x∗e2 ) − x∗e2 }. The following well-known result of Padberg and Rao [12] indicates how to identify the odd> set S with minimum capacity h(δ(S)). First, we give some additional notation. Suppose that each vertex v ∈ V is assigned some label λ with two possible values (odd or even). By extension, subsets of vertices also are assigned labels. In particular, for U ∈ V , λ(U ) is odd iff U contains an odd number of vertices labeled odd. Lemma 3.2 (Padberg and Rao [12]) Let G = (V, E) and ce ≥ 0 for all e ∈ E. Let V = V0 ∪ V1 where V1 is a nonempty set of nodes of G with odd label, V0 is the set of nodes with even label and λ(V ) is even. Let (M : V \ M ) be a minimum cut-set with respect to all pairs of odd labelled nodes in G. Then, there exists an odd minimum cut-set (X : V \ X) in G such that X ⊆ M or X ⊆ V \ M holds. 4 Let ce = he , for all e ∈ E, and V1 = {v ∈ V : v is odd> }. We assume that V1 6= ∅, since otherwise no odd> set exists. Since V is even> we obtain the following result. Corollary 3.3 Let Gx∗ = (V, Ex∗ ) and he ≥ 0 for all e ∈ Ex∗ . Let (M : V \ M ) be a minimum cut-set with respect to all pairs of odd> nodes in Gx∗ . Then there exists an odd> set S with minimum capacity h(δ(S)) such that S ⊆ M or S ⊆ V \ M holds. As it is well-known, Lemma 3.2 implies that a minimum odd cut-set will be one of the cuts that define the tree of min-cuts of all pairs of odd labelled vertices. Thus, a minimum odd cut-set will also be one of the cuts that define the tree of min-cuts of all pairs of nodes. Hence, Corollary 3.3 implies that an odd> set S with a minimum capacity h(δ(S)) will be one of the cuts that define T , the tree of min-cuts of all pairs of vertices of Gx∗ relative to the capacities vector h. We next turn our attention to how to identify an even> set S that minimizes h(δ(S)) + min{x∗e1 − (1 − x∗e1 ), (1 − x∗e2 ) − x∗e2 }. Lemma 3.4 Let (Sb : Sb \ V ) be a cut-set with Sb even> . b ∩ E> be such that h δ(S) b − (1 − xê ) + xê < 1. Then, there exist a cut-set a) Let ê ∈ δ(S) (S : V \ S) associated with one edge of T , ê ∈ δ(S), and F ⊂ δ(S), |F | odd, such that the corresponding inequality (1) is violated by x∗ . b ∩ E< be such that h δ(S) b − xê + (1 − xê ) < 1. Then, there exist a cut-set b) Let ê ∈ δ(S) (S : V \ S) associated with one edge of T , ê ∈ δ(S), and F ⊂ δ(S), |F | odd, such that the corresponding inequality (1) is violated by x∗ . Proof: a) Let (S : V \ S) be the minimum cut-set of T that separates the end-nodes of ê. Clearly ê ∈ δ(S). If S is odd> , given that b ≤ h δ(S) b − (1 − xê ) + xê < 1, h (δ(S)) ≤ h δ(S) the inequality (1) associated with S and F = δ(S) ∩ E> is violated by x∗ . Otherwise, S is even> . Now we define F = (δ(S) ∩ E> ) \ {ê}. |F | is odd and the value of the left hand side of the inequality (1) associated with S and F is given by h (δ(S)) − (1 − xê ) + xê ≤ h δ(Sb − (1 − xê ) + xê < 1, and the result follows. 2 b) The proof is similar to case a). 5 The above lemma implies that if there exist an even> set S, and a subset F ⊆ δ(S), |F | odd, such that its associated inequality (1) is violated by x∗ , then, there exists a cut-set in T (the tree of min-cuts of all pairs of vertices of Gx∗ relative to the capacities vector h) such that its associated inequality (1) is violated by x∗ . Lemma 3.4 is a new result that plays an important role. Due to this result, if there exist violated inequalities (1), one such inequality will be associated with a cut-set of T . Hence, Lemma 3.4 guarantees that the separation problem can be solved with order no greater than the procedure to find the min-cuts tree T . The algorithm that we propose starts building T , the tree of min-cuts of all pairs of vertices of Gx∗ relative to the capacities vector h. Then the edges in T are explored in turn until a min-cut is found for which the associated inequality (1) is violated, or until all the edges in T have been considered. For each considered min-cut δ(S i ), the vertex set S i is either odd> or even> . In the first case, we only have to check if its capacity is smaller than one. If so, F = δE > (S i ). When S i is even> , the associated set F will be F = δE > (S i ) \ {e1 } when x∗e1 − (1 − x∗e1 ) < (1 − x∗e2 ) − x∗e2 , or F = δE > (S i ) ∪ {e2 }, otherwise. Once F is defined, we have to check if F together with S i it defines a violated inequality (1). The algorithm is as follows: 3.5 Exact separation algorithm for inequalities (1) 1. Obtain T , the tree of min-cuts of all pairs of odd> vertices of Gx∗ . 2. Let (Si : V \ S i ) i = 1, . . . , r be the cut-sets associated with the edges of T . 3. for (i = 1, · · · , r) do 3.1 if S i is odd> and h(δ(S i )) < 1 then Terminate. (the inequality (1) with S = S i and F is violated by x∗ ). 3.2 if S i is even> and h(δ(S i ) + min{x∗e1 − (1 − x∗e1 ), (1 − x∗e2 ) − x∗e2 } < 1) then if x∗e1 − (1 − x∗e1 ) < (1 − x∗e2 ) − x∗e2 then F = δE > (S i ) \ {e1 } otherwise F = δE > (S i ) ∪ {e2 } endif Terminate. (the inequality (1) with S = S i and F is violated by x∗ ). endif endfor As a consequence of Corollary 3.3 and Lemma 3.4 we have the following result: Theorem 3.6 The separation Algorithm 3.5 is exact and the order of the algorithm is O(|V |4 ). Proof: Corollary 3.3 ensures that if there exist violated inequalities (1) associated with odd> sets, then Algorithm 3 will find one. Lemma 3.4 ensures that if there exist violated inequalities (1) 6 associated with even> sets, then Algorithm 3 will also find one. Thus, the separation algorithm is exact. The order of Algorithm 3.5 is dominated by the computations to obtain the min-cut tree T . T can be obtained with the algorithm of Gomory and Hu, which has an overall order of |V |4 (see [7]). 2 4 Improvements and Heuristics based on Algorithm 3.5. It is worth noting that, in practice, the upper limit on the order O(|V |4 ) of the algorithm is very seldom reached. Note that each connected component of the graph induced by the edges with 0 < x∗e < 1, already defines some of the cut-sets S i of the tree T , and the connected components of a graph can be obtained with a much smaller computational burden. Observe, however, that while odd> connected components always define violated inequalities (1), even> connected components do not define violated inequalities (1) since h(δ(S)) + min{x∗e1 − (1 − x∗e1 ), (1 − x∗e2 ) − x∗e2 } = 1. Given that, unless Gx∗ defines one single connected component, the size of each connected component will be smaller to that of Gx∗ , a possible improvement of Algorithm 3.5 is: a) to compute the connected components of Gx∗ ; and, if none of the connected components define a violated co-circuit inequality, then b) to apply Algorithm 3.5 independently to each of the connected components. Another possible improvement of algorithm 3.5 is to define an initial phase that only looks for violated inequalities associated with odd> sets. Then the second phase, which should be entered only if the first one failed, would only look for violated inequalities associated with even> sets. The potential advantage of such a variation is that, as implied by Lemma 3.2, odd> sets can be found in TO , the tree of min-cuts of all pairs of odd> vertices of Gx∗ relative to the capacities vector h, which typically will be smaller than T . Obtaining TO requires to solve |VO | − 1 maxflow problems, where VO stands for the subset of odd> vertices of V . If the second phase is entered, additional max-flow problems between pairs of even> vertices should be computed, so as to extend TO into T . Then the new edges in T \ TO should be explored in turn until a new min-cut is found for which the associated inequality (1) is violated, or until all the new edges in T \ TO have been considered. Since in the first phase the minimum cut-set associated with an odd> set had already been considered, the second phase should only consider even> sets. It is clear that a very simple and fast O(|E|) heuristic consists in computing the connected components of Gx∗ , induced by edges such that x∗e > , with 0 ≤ < 1 a given parameter. More sophisticated heuristics consist in considering a subclass of all inequalities (1) and to give an exact algorithm (of smaller order) to separate them. We next present such a heuristic when the subclass of inequalities (1) that we consider corresponds to sets S that are singletons, and the algorithm that we use is the particular case of Algorithm (3.5) to such sets. When S = {v} is a singleton inequalities (1) are: x(δ(v) \ F ) ≥ x(F )− | F | +1, ∀F ⊆ δ(v), |F | odd Now the separation algorithm is as follows: 7 (4) 4.1 Separation algorithm for S singletons: for (v ∈ V ) do 1. Let F = {e ∈ δ(v)|x∗e ≥ 0.5}. 2. if (|F | is even) then Let x∗e1 = min{x∗e |e ∈ F } and x∗e2 = max{x∗e |e ∈ δ(v) \ F }. if x∗e1 − 0.5 ≤ 0.5 − x∗e2 then delete e1 from F otherwise add e2 to F . 3. If the inequality (1) corresponding to this set F is violated by x∗ , then we have a cut. Theorem 4.2 The separation Algorithm (4.1) is exact and the order of the algorithm is |E|. Proof: Consider rewriting the inequalities (4): x∗ (δ(v) \ F ) + X (1 − x∗e ) ≥ 1, |F | odd. (5) e∈F It is clear that an edge e contributes to the left hand side of the above expression with value (1 − x∗e ) if it is in F , and with value x∗e if it is not. Therefore, Step 1. gives the set F with minimum value of the left hand side, and Step 2. gives the minimum correction to get an odd set. Hence, Algorithm 4.1 is exact. P For each vertex v, |δ(v)| edges are explored. Thus, in total |δ(v)| = 2|E| edges are v∈V considered, so the order of the algorithm is O(|E|) 5 2 Acknowledgements The authors are grateful to Enrique Benavent and Angel Corberán for their careful reading of a previous version of the paper. This research has been partially supported by grant MTM200614961-C05-01 of the Inter-Ministerial Spanish Commission of Science and Technology. References [1] J. Aráoz, E. Fernández and O. Meza. Solving the Prize-collecting Rural Postman Problem. Research Report DR2007/12, EIO Departament, Technical University of Catalonia (Spain), 2007 (submitted). [2] F. Barahona and M. Grötschel. On the cycle polytope of a binary matroid. Journal of combinatorial theory, Series B 40, 40-62, 1986. [3] J. M. Belenguer and E. Benavent. The capacitated arc routing problem: valid inequalities and facets. Computational Optimization and Applications 10, 165-187, 1998. 8 [4] E. Benavent, A. Corberán, J.M. Sanchis and I. Plana. Min-Max K-vehicles Windy Rural Postman Problem, Technical Report TR09-2007, Statistics and Operations Department, University of Valencia (Spain), http://www.uv.es/sestio/TechRep/tr09-07.pdf, 2007. [5] J. Edmonds. Maximum matching and a polyedron with 0,1-vertices. Journal of Research of the National Bureau of Standards B69B, 125–130, 1965. [6] G. Ghiani and G. Laporte. A branch-and-cut algorithm for the undirected rural postman problem. Mathematical Programming 87, 467–481, 2000. [7] R.E. Gomory and T.C. Hu. Multi-terminal network flows. SIAM Journal of Applied Mathematics 9, 551-556, 1961. [8] M. Grötschel and O. Holland. A Cutting Plane Algorithm for Minimum Perfect 2Matchings. Computing 39, 327–344, 1987. [9] M. Grötschel and M.W. Padberg,“Polyhedral Theory”, in: E. Lawler, J.K. Lenstra, A.H.G. Rinnooy Kan, and D.B. Shmoys The Traveling Salesman Problem: A guided Tour of Combinatorial Optimization. Wiley, Chichester, 1985. [10] A.N. Letchford, G. Reinelt and D.O. Theis. A faster exact separation algorithm for blossom inequalities. In D. Bienstock and G. Nemhauser (eds.), Integer Programming and Combinatorial Optimization 10, volume 3064 of LNCS, pp. 196205. Springer- Verlag, Berlin/Heidelberg, 2004. [11] M.W. Padberg and M. Grötschel, “Polyhedral computation”, in: E. Lawler, J.K. Lenstra, A.H.G. Rinnooy Kan, and D.B. Shmoys Eds. The Traveling Salesman Problem: A guided Tour of Combinatorial Optimization. Wiley, Chichester, 1985. [12] M. Padberg and M.R. Rao. Odd minimum cut-sets and b-matchings. Mathematics of Operations Research 7, 67-80, 1982. [13] M. Padberg and G. Rinaldi. Facet identification for the Symmetric Traveling Salesman Polytope. Mathematical Programming 47, 219-257, 1990. [14] A. Schrijver. “Min-Max results in Combinatorial Optimization”, in A. Bachem, M. Grötschel and B. Korte Eds Mathematical Programming- The State of the Art, Springer, Heidelberg, 1983. 9