Polynomially solvable cases of NP-hard problems Vladimir Deineko Polynomially solvable cases of NP-hard problems Based on joint works with R.Burkard, D.Foster, B.Klinz, R.Rudolf, M.Sviridenko, J.Van der Veen, G. Woeginger Discrete Optimization & OR 2013
Outline Travelling Salesman Problem (TSP) Four-point (4P) conditions - classification Euclidean TSP with 4P conditions Classification & Recognition Summary: Further research opportunities
c()=c(1,5)+c(5,2)+c(2,3)+c(3,4)+c(4,6)+c(6,1) The travelling salesman problem (TSP) 1 2 3 4 5 6 30 45 53 58 42 20 36 50 35 37 16 24 17 city3 city2 city5 city1 city4 city6 Find a cyclic permutation that minimizes =<1,5,2,3,4,6,1> 1 5 6 2 3 4 c()=c(1,5)+c(5,2)+c(2,3)+c(3,4)+c(4,6)+c(6,1)
of the first version of the talk Outline of the first version of the talk Travelling Salesman Problem (TSP) Four-point (4P) conditions - classification Euclidean TSP with 4P conditions Classification & Recognition Summary: Further research opportunities Discrete Optimization & OR 2013
Outline So what? Is it of any use for a wider community? Travelling Salesman Problem (TSP) Four-point (4P) conditions - classification Euclidean TSP with 4P conditions Classification & Recognition Is it of any use for a wider community? Discrete Optimization & OR 2013
Outline Special structures useful in other problems, e.g. Master Tour problem Exponential neighbourhoods and solvability conditions: Optimal implementation of Double-tree algorithm Techniques useful in other problems Bipartite TSP Real life OR problems Travelling Salesman Problem (TSP) Four-point (4P) conditions - classification Euclidean TSP with 4P conditions Classification & Recognition Discrete Optimization & OR 2013
TSP with specially structured matrices 1 2 3 4 5 6 1 2 3 4 5 6 30 45 53 58 42 20 36 50 35 37 16 24 17 j i k l cjl cik + cil cjk clk cij + clj cik cij cik clk (cmn )= clj + <1,2,…,n> is an optimal TSP tour (Kalmanson, 1975)
Specially Structured Matrices: notations + c2,4 c3.3 1 2 3 4 5 6 - Specially structured matrices i j k l
Two-exchange and four-point conditions We consider the TSP with special matrices (cst) such that clk cij + clj cik All permutations i j l k NP-hard arbitrary tour τ O(n2) pyramidal tours N-permutations O(n4)
Four Point Conditions for symmetric TSPs: Classification Demidenko conditions Pyramidal O(n2) 1976 Supnick O(n) 1957 Kalmanson O(n) 1975 NP-hard D,W 2000 Max Demidenko Pyramidal O(n2) 1994 Van der Veen conditions NP-hard Steiner et al 2005 Max Van der Veen NP-hard D,Tiskin 2006 Relaxed Supnick N-perm O(n4) D, 2004 Relaxed Kalmanson
Four Point Conditions: Classification Demidenko conditions Pyramidal 1976 Pyramidal Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Kalmanson 1970 1,2,3,…,n Supnick 1957 1,3,5,…2,1 Van der Veen conditions Pyramidal 1992 Similar to Supnick Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Similar to Supnick NP-hard D,W 1997 NP-hard Supnick Max,1957 1971,87 Kalmanson Max,1970 Max Demidenko NP-hard Steiner et al 2005 New (linear) case Special Max Kalmanson Max Van der Veen N-perm O(n4) Special Lawler O(n2) Relaxed Kalmanson NP-hard D,T 2006 Relaxed Supnick
Recognition of specially structured matrices dij dik dlk (dmn )= dlj cij cik clk (cmn )= d(m)(n) = clj X + Is there a permutation to permute rows and columns in the matrix so that the new permuted matrix (cmn) with cmn= d(m)(n) is a Relaxed Kalmanson (Kalmanson, Supnick, Demidenko ,…) matrix? 1 2 3 4 5 6 7 8
? ? Four Point Conditions for symmetric TSPs: Recognition Demidenko conditions O(n4) 1999 Unpublished D,W O(n2log n) 1998 D,R,W O(n2)? C,F,T Max Demidenko ? Van der Veen conditions Max Van der Veen ? Relaxed Supnick Relaxed Kalmanson
Four Point Conditions for TSP: Recognition Euclidean Demidenko conditions O(n4) Van der Veen, D., Rudolf, Woeginger n<17 Max Demidenko Conjecture: n<7. O(n4) D., Burkard Van der Veen conditions n<17 Max Van der Veen n<17 or all are on the line Relaxed Supnick O(n4) D., Foster Sviridenko Relaxed Kalmanson
Four Point Conditions for TSP: Recognition Euclidean Relaxed Kalmanson > = d(n1,n3 )-d(n2,n3 )≥ d(n1,n4 )-d(n2,n4 ) d(n1,n4 )-d(n2,n4 )= d(n1,n5 )-d(n2,n5 )
Four Point Conditions for TSP: Recognition Euclidean Relaxed Kalmanson (i) Two branches of hyperbolea intersect in no more than 4 points. (ii) Two branches of hyperbolea with a common focal point intersect in no more than 2 points. Xu,Sahni,Rao, 2008 object localisation
Four Point Conditions: Classification Demidenko conditions Pyramidal 1976 Pyramidal Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Kalmanson 1975 1,2,3,…,n Supnick 1957 1,3,5,…2,1 Van der Veen conditions Pyramidal 1992 Similar to Supnick Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Similar to Supnick NP-hard D,W 1997 NP-hard Supnick Max,1957 1971,87 Kalmanson Max,1970 Max Demidenko NP-hard Steiner et al 2005 New (linear) case Special Max Kalmanson Max Van der Veen N-perm O(n4) Special Lawler O(n2) Relaxed Kalmanson NP-hard D,T 2006 Relaxed Supnick
Monge (Supnick) matrices Monge (1781): For an optimal transportation of goods from locations P1 and Q1 to locations P2 and Q2 the routes from P1 and from Q1 must not intersect. P1 P2 Q2 Q1 d(P1,P2) d(P1,Q2) d(Q1,P2) d(Q1,Q2) Gaspard Monge, 1746-1818 d(P1,P2)+d(Q1,Q2)≤ d(P1,Q2)+d(Q1,P2) Monge 1781 - transportation Supnick 1956 - TSP Hoffman 1963 – transportation; introduced Monge; Burdjuk,Trofimov 1976 – TSP with permuted Monge matrices D.,Filonenko 1979 – recognition of Monge matrices Burkard, Klinz,Rudolf: Perspectives of Monge Properties in Optimization. Survey(1996) D., Jonsson, Klasson, Krokhin: The approximability of MAX CSP with fixed-value constraints.) 2008
Four Point Conditions: Classification Demidenko conditions Pyramidal 1976 Pyramidal Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Kalmanson 1975 1,2,3,…,n Supnick 1957 1,3,5,…2,1 Van der Veen conditions Pyramidal 1992 Similar to Supnick Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Similar to Supnick NP-hard D,W 1997 NP-hard Supnick Max,1957 1971,87 Kalmanson Max,1970 Max Demidenko NP-hard Steiner et al 2005 New (linear) case Special Max Kalmanson Max Van der Veen N-perm O(n4) Special Lawler O(n2) Relaxed Kalmanson NP-hard D,T 2006 Relaxed Supnick
Kalmanson Matrices:TSP with the master tour + Kalmanson Matrices:TSP with the master tour j i k l An optimal TSP tour < 1, 2, 3,…, n, 1> is called the master tour, if it is an optimal tour and it remains to be an optimal after deleting any subset of cities.
Illustration to Master Tour problem PostCode 15 A15 PostCode 14 A14 PostCode 13 A13 PostCode 12 A12 PostCode 11 A11 PostCode 10 A10 PostCode 9 A9 PostCode 8 A8 PostCode 7 A7 PostCode 6 A6 PostCode 5 A5 PostCode 4 A4 PostCode 3 A3 PostCode 2 A2 PostCode 1 A1 Given a set of customers TSP: Find a tour with the minimal total length PostCode 15 A15 PostCode 14 A14 PostCode 13 A13 PostCode 12 A12 PostCode 11 A11 PostCode 10 A10 PostCode 9 A9 PostCode 8 A8 PostCode 7 A7 PostCode 6 A6 PostCode 5 A5 PostCode 4 A4 PostCode 3 A3 PostCode 2 A2 PostCode 1 A1 Given a set of today’s customers ???
Illustration to Master Tour problem PostCode 15 A15 PostCode 14 A14 PostCode 13 A13 PostCode 12 A12 PostCode 11 A11 PostCode 10 A10 PostCode 9 A9 PostCode 8 A8 PostCode 7 A7 PostCode 6 A6 PostCode 5 A5 PostCode 4 A4 PostCode 3 A3 PostCode 2 A2 PostCode 1 A1 Given a set of customers Find a tour with the minimal total length PostCode 15 A15 PostCode 14 A14 PostCode 13 A13 PostCode 12 A12 PostCode 11 A11 PostCode 10 A10 PostCode 9 A9 PostCode 8 A8 PostCode 7 A7 PostCode 6 A6 PostCode 5 A5 PostCode 4 A4 PostCode 3 A3 PostCode 2 A2 PostCode 1 A1 Given a set of today’s customers ???
Kalmanson Matrices: TSP with the master tour j i k l An optimal TSP tour < 1, 2, 3,…, n, 1> is called the master tour, if it is an optimal tour and it remains to be an optimal after deleting any subset of cities. Conjecture (Papadimitriou, 1983) The master tour problem is ∑2P-complete. Sometimes travelling is easy: D., Rudolf, Woeginger, 1998 For a distance matrix C, a tour < 1, 2, 3,…, n, 1> is the master tour, if and only if C is a Kalmanson matrix. Permuted Kalmanson matrices can be recognized in O(n2) time
Four Point Conditions: Classification Demidenko conditions Pyramidal 1976 Pyramidal Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Kalmanson 1975 1,2,3,…,n Supnick 1957 1,3,5,…2,1 Van der Veen conditions Pyramidal 1992 Similar to Supnick Sum Matrix c(i,j)=u(i)+v(j) Kalmanson subclass Similar to Supnick NP-hard D,W 1997 NP-hard Supnick Max,1957 1971,87 Kalmanson Max,1970 Max Demidenko NP-hard Steiner et al 2005 New (linear) case Special Max Kalmanson Max Van der Veen N-perm O(n4) Special Lawler O(n2) Relaxed Kalmanson NP-hard D,T 2006 Relaxed Supnick
Specially structured matrices & Exponential neighbourhoods cij cik clk (cmn )= clj + 1 n 2 3 4 5 6 n-1 Kalmanson (1970) K*= <1,2,…,n> is an optimal TSP tour (cmn )= Supnick (1957) matrices S*= <1,3,5,7…,n,…,6,4,2> is an optimal TSP tour 1 n 2 3 4 5 6 7 8 cij cik clk (cmn )= clj Demidenko (1976) * is a pyramidal tour
Demidenko TSP: Demidenko,1979: An optimal TSP tour can be found among 2n-2 pyramidal tours in O(n2) time n P2 P1 Structure of dynamic programming recursions: 2 3 4 5 6 7 8 9 1 1 P1(i,j)=min{ci,j+1+P2(j,j+1), cj+1,j+P1(i,j+1)} P2(i,j)=min{cj,j+1+P2(i,j+1), cj+1,i+P1(j,j+1)} P1(i,n)=cj,n P2(i,n)=cj,n
Double Tree algorithm & Exponential neighbourhoods F(9,6) H(6,2) B(5,6) I(6,0) E(3,4) D(0,4) A(5,8) C(2,7) G(9,4) begin Compute the minimum spanning tree; Double every edge in the tree to get an Eulerian graph; Find an Eulerian circuit and transform the circuit into a TSP tour by shortcutting: for every city remove all but one of its occurrence in the Eulerian circuit. end H I F B E D A C G <IHEBABECEDEHGFGH I> <IHEBA C D GF I> D I H E B A C F G
2 is the tight bound for the Double Tree Algorithm Theorem (Folklore). A tour tree found by the Double Tree Algorithm is guaranteed to have no more than twice the length of the optimal tour opt for the TSP. 2 is the tight bound for the Double Tree Algorithm Bad News Good News 1 ~2n+2n(1- ) ~2n+2 4 5 6 2 m 3 n tree opt G B H F I E D A C
Is it possible to find in polynomial time the best tour among all tours constructed by the Double-Tree Algorithm? G B H F I E D A C F G D A I H E B C
Double tree for metric TSP: Optimal implementation “Conjecture” (Papadimitiou, Vazirani, 1986) The problem of finding the best tour among all tours constructed by the Double-Tree Algorithm is NP-hard. Burkard, D.,Weginger, 1999, TSP & PQ-trees; O(n3) time, O(n2) space D., Tiskin, 2009, An optimal tour amongst of all those constructed by the tree algorithm can be found in O(2dn2) time and O(22dn) space, where d is a maximum vertex degree in the spanning tree.
Dynamic programming for the TSP B H F I E D A C O(2dn2) algorithm +”good” heuristic F G D A I E C F G D I H E C A Set of all n! tours O(n2 2n) well known DP algorithm +exact solution n n-1 n-2 ... 2 1 Pyramidal Tours O(n2) algorithm +Special solvable cases G B H F I E D A C DTd
The best tour constructing heuristic x
The bipartite travelling salesman problem (BTSP) city3 city2 city5 “black” and “white” points have to alternate in a feasible tour city1 city4 city6 Shoe-lace problem (Halton,1995; Misiurewicz, 1996)
The bipartite travelling salesman problem (BTSP) point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
point2 point1 point3 item1 item3 item2
Transformation technique Arbitrary permutation 0 c(0) c(1) set of permutations 1 c(1) c(2) 2 special subset
Bipartite Travelling Salesman, or ShoeLace Problem for very old shoes V.D.,G.Woeginger
1 2 4 5 6 7 8 9 10 12 -6.0 -10.6 1.5 -1.1 -0.5 -3.0 2.1 -4.2 1.4 1.2 -0.5 -5.4 0.8 -0.8 -0.3 -0.7 -5.5 -0.1 -9.4 -4.0 -0.2 0.1 -0.4 -2.7 -4.4 1 2 4 5 6 7 8 9 10 12 -5.6 -0.2 -0.5 0.2 -0.0 -8.5 -13.5 -0.2 -5.4 +0.0 -5.7 -0.2 -0.6 -11.9 -0.8 -5.7 0.1 -12.3 11.3 -0.0 5.2 -0.6 7.7 -13.8 -2.5
Summary “Byproducts” Special structures useful in other problems, e.g. Master Tour problem Exponential neighbourhoods and solvability conditions, Optimal implementation of Double-tree algorithm Techniques useful in other problems Bipartite TSP Real life OR problems Travelling Salesman Problem (TSP) Four-point (4P) conditions - classification Euclidean TSP with 4P conditions Classification & Recognition
Transformation technique for Bipartite TSP
Transformation technique
Recognition of special cases
Recognising Relaxed Supnick / Kalmanson matrices 1 1 0-1 RK matrix before and after permuting rows/columns
Hard Instances for the Optimal Double-Tree Algorithm Optimal TSP tour 6A Minimal Spanning Tree Optimal double-tree tour 6A+√3 A The approximation ratio is (6A+√3 A)/6A 1.622
Relaxed Supnick TSP: dynamic programming recursions − } ≥h h=2 linear time algorithm P2 P1 Compare with DP for pyramidal tours
Three-exchange and six-point conditions j i l k m n Three-exchange and six-point conditions i j l k m n <i, j, k, l, m, n> 5!*4=480 cases l i j k m n add 480*479/2=114960 cases if consider pairs of the conditions i j l k m n i j l k m n
Two dimensional bin packing 3 X 1 2 4 5 6 Y 1 2 3 4 5 6
Binary vector packing problem Motivation: Allocation of Students to Working Teams We want groups with the same number of male/female maths / non-maths leaders collaborators mature students … Student A being allocated to Group X should not be disadvantaged (compared with student B being allocated to Group Y)
Vehicle Routing Problem (CCC case study) Given a set of customers (& demand), a set of vehicles (& capacity), SERVE all customers satisfying the demand and not exceeding the capacity.
Current partition of customers for one of the collection services in CCC Partition of customers found by the new algorithms (up to 20% savings in transportation costs)