Metheuristis for the Asymmetri Hmiltonin Pth Prolem João Pero PEDROSO INESC - Porto n DCC - Fule e Ciênis, Universie o Porto, Portugl jpp@f.up.pt Astrt. One of the most importnt pplitions of the Asymmetri Hmiltonin Pth Prolem is in sheuling. In this pper we esrie vrint of this prolem, n evelop oth mthemtil progrmming formultion n simple metheuristis for solving it. The formultion is se on trnsformtion of the input t, in suh wy tht stnr mthemtil progrmming moel for the Asymmetri Trvelling Slesmn Prolem n e use on this slightly ifferent prolem. Two stnr metheuristis for the symmetri trvelling slesmn re propose n nlyse on this vrint: repete rnom onstrution followe y lol serh with the 3-Exhnge neighourhoo, n iterte lol serh se on the sme neighourhoo n on 4-Exhnge perturtion. The omputtionl results otine show the interest n the omplementry merits of using mixe-integer progrmming solver n n pproximtive metho for the solution of this prolem. 1 Introution We re eling with the following prolem: given n opertion urrently eing one in mhine, etermine the orer for the set of opertions to e proue next, suh tht the totl proution time is minimize. There re no preeene onstrints mong the opertions, ut there re hngeover times whih epen on the proution sequene. Minimizing the totl proution time is equivlent to minimizing the time spent in hngeovers, s the other times re onstnt. This prolem is relevnt in mny prtil situtions. In pint proution the mhine lening times re usully epenent on the sequene; for exmple, prouing white olour fter grey requires muh more reful lening thn the other wy roun. The proution of steel is lso sitution where the sequene of proution is very importnt, hving very strit rules n osts tht epen on the orer. Yet nother prtil pplition is in foo mnufturing, where strong flvours n e proue fter flvourless prouts t smll ost, ut very reful n lengthy lening is require in the inverse sitution. One possiility for moelling this prolem is to onsier grph with noe for eh of the items tht must e proue. There re two rs etween every pir of noes, one in eh iretion, representing the hngeover time etween the orresponing prouts. A solution to the originl prolem orrespons to
etermining Hmiltonin pth in this grph, i.e., pth going through ll the noes in the grph. The pth must strt with prtiulr noe (the item eing urrently proue), ut there is no onern out the ening noe. Let us ll this the Fixe-Strt Asymmetri Hmiltonin Pth (FSAHP) prolem. Given the similrity of this prolem with the Trvelling Slesmn Prolem, in prtiulr with its symmetri vrints, we onsiere pting the methos tht hve een evelope for tht prolem to the urrent sitution. Throughout this pper we will esrie more formlly the prolem in mthemtil progrmming, explin in etil the metheuristis tht we implemente for solving it, n present the results of pplying it to set of enhmrk prolems. 2 Prolem esription We re given grph G(V, A) where V is the set of noes n A the set of rs. In the lssil Asymmetri Trvelling Slesmn Prolem (ATSP), noes orrespon to ities to e visite n rs to the istne etween them. In our se, eh noe represents prout to e mnufture, every r (i, j) hs ost D(i, j) orresponing to the (symmetri) hngeover time etween prout i n j, n there is speil noe v 1, whih must e the first noe in the pth, n orrespons to the lst previously mnufture prout (or to the ity where the slesperson urrently is, the lssil prolem). With simple t preproessing, stnr ATSP formultions n e pte to the urrent prolem, s shown elow. Property 1. Reefine the istne from ny noe to the first (fixe) noe in the pth, v 1, s zero (ll other istnes remining unhnge). A minimum Hmiltonin yle etermine with this t efines pth whih is n optiml solution to the FSAHP, with the sme optiml ojetive vlue. Proof. Let us ll the optiml solution to the FSAHP (p 1,..., p n); this is pth, with p 1 = v 1, overing ll the noes. This pth n e extene into yle, without inresing the ost, y ing the r (p n, v 1). Suppose there is yle (s 1,..., s n, s 1), with s 1 = v 1, with smller ojetive; then, s the r (s n, v 1) hs zero length, the pth (s 1,..., s n) woul hve to e shorter thn (p 1,..., p n). But in this se (s 1,..., s n) woul e etter solution to the FSAHP thn (p 1,..., p n), ontriting the ssumption. 2.1 Formultion in mthemtil progrmming There re mny formultions for the ATSP, n their stuy is n tive fiel in mthemtil progrmming. For the purposes of this pper, we will restrit to the most ommon one, ue to [1]: n n minimise ij x ij (1) i=1 j=1
n x ij = 1, j = 1,..., n i=1 n x ij = 1, j=1 i = 1,..., n (n 1)x ij + u i u j n 2, i, j = 2,..., n x ij {0, 1}, i, j = 1,..., n, u i R i = 1,..., n The optiml yle is the set of rs (i, j) suh tht x ij = 1. The solution to the FSAHP is the n-noe pth strting with v 1 in this yle. 3 Bsi heuristis n lol serh The most strightforwr wy for solving the Fixe-Strt Asymmetri Hmiltonin Pth with heuristis n metheuristis is to pply the trnsformtion on the t propose in Setion 2, n solve n Asymmetri Trvelling Slesmn. Then, the solution to the originl prolem is otine y seleting the n-noe pth strting with v 1 in the ATSP s solution. The hrteristis of the pth prolem oul e exploite for evising more pte neighourhoos, ut it turns out tht the performne egres in most of the stuie instnes, possily ue to the losing symmetry properties. 3.1 Constrution Simple onstrution heuristis for the ATSP re se on equivlent heuristis for the symmetri TSP (niely esrie e.g. in [2]). As for the metheuristis esrie in this pper, the initil solution is onstrute se on rnom permuttion of {1,..., n}. 3.2 Improvement The most ommon improvement methos for prolems relte to the TSP re se on exhnge heuristis: remove k eges, reking the yle tour into k pths; then reonnet those pths into ifferent yle [3, 4]. For the symmetri TSP, the most ommonly use neighourhoo is 2-Exhnge: remove two nononseutive eges, n two other eges, s shown in Figure 1. As for the ATSP, there re no 2-Exhnge moves tht keep pth orienttion, n hene they re not usully employe [5]. The most ommonly use moves re 3-Exhnge, keeping pth orienttion, s shown in Figure 2. For implementing lol serh se in this neighourhoo in n effiient wy, moves tht re known not to le to improvements shoul e voie. For this purpose, the list of the neighours of given vertex, sorte y istne, is serhe only up to ertin point.
Let us first rell wht is ommonly one with the (symmetri) TSP. Consier tour represente y p = (p 1, p 2,..., p n ), n let us enote the lst element of p s either p n or p 0. Eh ege (p i 1, p i ), for i = 1,..., n, is exmine for improving exhnges, through removing it n nother ege (p j 1, p j ), n ing two ifferent eges, in suh wy tht new tour is forme (p j must e seprte from p i y t lest two noes). A new tour is onstrute y ing eges {p i 1, p j 1 } n {p i, p j }. Property 2. For given i, improving moves nnot e misse if j is restrite to: 1. noes onnete to p i 1 suh tht their istne to p j 1 is smller thn D(p i 1, p i ); 2. noes onnete to p i suh tht their istne to p i is smller thn D(p i 1, p i ). Proof. Let p i 1, p i, p j 1, p j e represente y,,,, respetively, s in Figure 1. In n improving move there must e D(, ) + D(, ) < D(, ) + D(, ), implying tht either D(, ) < D(, ) or D(, ) < D(, ), or oth. Hene, in n improvement, t lest one of the e eges must e smller thn t lest one of the remove eges. The se of n e ege eing smller thn {, } is exmine y onsiering ll eges {, } suh tht D(, ) < D(, ), n ll eges {, } suh tht D(, ) < D(, ). The remining potentil improvement se orrespons to hving the ege {, } lrger thn either {, } or {, }; ut this possiility is exmine for i suh tht = p i 1 n = p i. Let us now go k to the ATSP prolem n the 3-Exhnge neighourhoo. Consier tour represente y p = (p 1, p 2,..., p n ). Eh r (p i 1, p i ), for i = 1,..., n, is exmine for improving exhnges, through removing it n other two rs (p j 1, p j ) n (p k 1, p k ). A new tour is onstrute y ing rs (p i 1, p j ), (p j 1, p k ), n (p k 1, p i ). Property 3. For given i, improving moves nnot e misse if j n k re restrite s follows: 1. j is restrite to noes outgoing from p i 1 suh tht their istne from p i 1 is smller thn D(p i 1, p i ); furthermore, in this se k is restrite to noes outgoing from p j 1 suh tht istne D(p i 1, p j ) + D(p j 1, p k ) is smller thn D(p i 1, p i ) + D(p j 1, p j ), n p k is not in the pth from p i to p j 1. 2. k 1 is restrite to noes inoming into p i suh tht their istne to p i is smller thn D(p i 1, p i ); furthermore, in this se j is restrite to noes inoming into p k suh tht istne D(p k 1, p i )+D(p j 1, p k ) is smller thn D(p i 1, p i ) + D(p k 1, p k ), n p j is not in the pth from p k to p i 1. Proof. Let p i 1, p i, p j 1, p j, p k 1, p k e represente y,,,, e, f, respetively, s in Figure 2. In n improving move there must e D(, ) + D(, f) + D(e, ) < D(, ) + D(, ) + D(e, f), implying tht t lest one of the e rs must e smller thn t lest one of the remove ones. Let us onsier n improving move for whih either D(, ) + D(, f) > D(, ) + D(, ), or D(, ) > D(, ). In the former se, there must e D(e, ) < D(e, f), n
Fig. 1. Single 2-Exhnge possiility for the (symmetri) TSP. Eges {, }, {, } re remove, n reple y {, }, {, }. e e f f Fig. 2. Single 3-Exhnge possiility without pth inversions for the ATSP. Ars (, ), (, ), (e, f) re reple y (, ), (e, ), (, f). h g f e h g f e Fig. 3. A 4-Exhnge (oule rige) movement without pth inversions for the ATSP, s implemente in iterte lol serh. this is tkle in the min i yle, for i : p i 1 = e. As for the ltter se, there must e D(, f)+d(e, ) < D(, )+D(e, f); thus, either D(, f) < D(, ), or D(e, ) < D(e, f), or oth. But this sitution is tkle for i : p i 1 = or i : p i 1 = e, respetively. 3.3 Implementtion In our implementtion, inies for the outer yle (i) re serhe in rnom orer. Inies j n k re serh y inresing istne to noes p i 1 n p i, until rehing the limits efine y Property 3. Improvements re epte in n first-improve mnner, i.e., n improving movement is immeitely epte. The initil solution is rnom permuttion of {1,..., n}.
3.4 Improve heuristis Rnom-strt lol serh: in this metheuristis, the following steps re repete until rehing stopping riterion (in our implementtion, exeeing the limit CPU time): 1. rete rnom solution; 2. improve it until rehing lol optimum; 3. possily, upte the est solution foun so fr. Iterte lol serh: for this metheuristis, fter rehing lol optimum eep moifition on the solution struture is introue; the solution thus otine is then improve until rehing nother lol optimum, n the whole proess is repete until rehing the stopping riterion. The eep moifition me t eh itertion is 4-Exhnge movement, s epite in Figure 3. This is usully lle oule rige movement. Our implementtion of iterte lol serh onsists of otining rnom strting solution, n then repeting the following steps: 1. improve the solution until rehing lol optimum; 2. possily, upte the est solution foun so fr; 3. rnomly selet 4 rs in the solution; exhnge them with 4 ifferent rs, in suh wy tht tour (with no pth inversions) is forme. 4 Results The metheuristis propose in this pper were ompre to mixe-integer progrmming (MIP) solver, through n experiment with set of stnr enhmrks instnes. These orrespon moifition of the ATSP instnes ville in the TSPLIB [6]; the strting noe v 1 is the first ity in the instne, n, for tkling the pth prolem, the istnes from ny other noe to v 1 re reefine s zero (s esrie in Setion 2). The experiment ws run in omputer with Qu-Core Intel Xeon, 2.66 GHz proessor, running the M OS X operting system version 10.6.3; only one CPU ws llote to this experiment. The MIP solver use is GUROBI [7], one of the leing ommeril solvers. Metheuristis were implemente in the Python progrmming lnguge, version 2.6.1; this is onsierly slower thn the ompile, exeutle oe of GUROBI. Hene, results re not truly omprle; however, they still llow rwing mny interesting onlusions. In ll the experiments, the CPU time for n oservtion of metho solving n instne ws limite to out 300 seons; s for the metheuristis, the results orrespon to the minimum, verge, n mximum of 10 inepenent oservtions. The results re presente in tle 1. The first interesting onlusion is tht stte-of-the-rt MIP solver n reh the optimum for mny of the enhmrk instnes (those for whih the lower oun otine is ientil to the upper oun); this is n enormous progress with respet to some yers go. In these ses, oth metheuristis oul lso
fin systemtilly the optimum, exept for instnes of the ftv series. For these instnes n tex5, the result of the MIP solver is etter thn the verge solution of eh metheuristis; for ll the other instnes, oth metheuristis re etter. A very interesting result ws otine for instnes rg403 n rg443; inee, even though no fesile solution ws foun y the MIP solver in the Multi-strt lol serh Iterte lol serh GUROBI Instne minimum verge mximum minimum verge mximum LB UB tex1 1564 1564 1564 1564 1564 1564 1564 1564 tex3 2342 2342 2342 2342 2342 2342 2342 2342 tex4 2681 2681 2681 2681 2681 2681 2681 2681 tex5 4659 4663.8 4669 4659 4670.8 4747 4595 4659 tex8 41531 41763 41960 41299 41598.8 41900 1027 ig702 78933 79081.4 79316 78492 78847.4 79518 r17 27 27 27 27 27 27 27 27 oe198 4541 4541 4541 4541 4541 4541 4541 4541 oe253 106957 106957 106957 106957 107032 107333 105716 112 10916 10919.3 10922 10914 10916.7 10919 10860 10968 126 120725 120770 120827 120709 120754 120808 119702 126506 134 5543 5544.6 5547 5539 5540.8 5542 5529 176 8402 8406.3 8410 8400 8403.3 8409 8356 188 9977 9979.9 9986 9974 9979.8 9988 9911 563 25880 25880 25880 25880 25880 25880 25687 849 37496 37501.7 37506 37488 37498.6 37504 895 106963 106963 106963 106963 106963 106963 932 478316 478316 478316 478316 478316 478316 ft53 6099 6099 6099 6099 6099 6099 6099 6099 ft70 37230 37231.2 37234 37230 37230.4 37234 37228 37230 ftv100 1743 1746.5 1747 1743 1744.7 1747 1743 1743 ftv110 1908 1910.6 1914 1908 1912.3 1917 1900 1908 ftv120 2074 2078.2 2081 2074 2074.5 2077 2074 2074 ftv130 2240 2250.2 2262 2240 2242.7 2250 2240 2240 ftv140 2358 2364.4 2375 2358 2360.1 2366 2356 2356 ftv150 2547 2554.5 2563 2547 2548.1 2550 2547 2547 ftv160 2600 2605.5 2616 2600 2603.1 2605 2600 2600 ftv170 2690 2701.7 2717 2689 2691.4 2694 2668 2713 ftv33 1223 1223 1223 1223 1223 1223 1223 1223 ftv35 1363 1363 1363 1363 1363 1363 1363 1363 ftv38 1438 1438 1438 1438 1438 1438 1438 1438 ftv44 1535 1535 1535 1535 1535 1535 1535 1535 ftv47 1689 1689 1689 1689 1689 1689 1689 1689 ftv55 1539 1539 1539 1539 1539 1539 1539 1539 ftv64 1726 1726 1726 1726 1726 1726 1726 1726 ftv70 1881 1881 1881 1881 1881 1881 1881 1881 ftv90 1538 1538 1538 1538 1538 1538 1538 1538 kro124p 35584 35584 35584 35584 35584 35584 35581 35584 p43 589 589 589 589 589 589 549 589 rg323 1308 1308 1308 1308 1308 1308 1308 1308 rg358 1143 1143 1143 1143 1143 1143 1143 1143 rg403 2450 2450 2450 2450 2450 2450 2450 rg443 2710 2710 2710 2710 2711.7 2719 2710 ry48p 13870 13870 13870 13870 13870 13870 13869 13870 t100.1 267047 267047 267047 267047 267047 267047 267047 267058 t1000.20 1241220 1241230 1241230 1241220 1241230 1241230 t316.10 688929 688929 688929 688929 688929 688929 688929 688929 Tle 1. Results otine using multi-strt lol serh, iterte Lol serh, n the lower n upper ouns otine y the MIP solver GUROBI, for CPU limit of 300 seons. (Instnes 563, 895, 932 were llowe only one esent, s it tkes more thn 300 seons.)
CPU time llowe, the est solution foun y metheuristis n e proven optiml, s its ojetive vlue equls the MIP lower oun. As for the omprison etween the two metheuristis propose, iterte lol serh is t lest s goo s multi-strt lol serh for most instnes, eing stritly etter for mny of them; the slight inrese in omplexity seems, hene, to e worthy. 5 Conlusions In this pper we esrie vrint of the Asymmetri Hmiltonin Pth Prolem, with pplitions in sheuling. We present mthemtil progrmming formultion, n simple pproximtive methos for solving it. The metheuristis re rnom-strt lol serh n iterte lol serh; oth of them provie very goo results, with slight vntge to the ltter. For esy prolems mixe-integer progrmming solver oul fin the optimum in reltively smll time; for lrger, more iffiult prolems, the pproximtive methos oul fin etter solutions in the CPU time llowe. Improvements on the metheuristis re expete if on t look its re use, in orer to keep trk of ities for whih serh oul e skippe. Another possile improvement onerns limiting the numer of neighours of eh ity tht re llowe to e explore for exhnges. Both of these moifitions my provie onsierle speeup, t the ost of, possily, loosing lol optimlity. Aknowlegments. This reserh ws supporte in prt y FCT Função pr Ciêni e Tenologi (Projet **PTDC/GES/73801/2006) n y the Europen projet CIVITAS-ELAN, uner Frmework Progrmme 7. Our speil thnks to Prof. Nelm Moreir for proof reing this mnusript. Referenes 1. Miller, C.E., Tuker, A.W., Zemlin, R.A.: Integer progrmming formultion of trveling slesmn prolems. J. ACM 7(4) (1960) 326 329 2. Johnson, D., MGeoh, L.: Lol serh in omintoril optimiztion. In Arts, E., Lenstr, J.K., es.: Lol serh in omintoril optimiztion. John Wiley & Sons, In., New York, NY, USA (1997) 3. Croes, G.A.: A metho for solving trveling-slesmn prolems. Opertions Reserh 6 (1958) 791 812 4. Floo, M.M.: The trveling-slesmn prolem. Opertions Reserh 4 (1956) 61 75 5. Johnson, D.S., Gutin, G., MGeoh, L.A., Yeo, A., Zhng, W., Zverovith, A.: Experimentl nlysis of heuristis for the tsp. In Gutin, G., Punnen, A.P., es.: The Trveling Slesmn Prolem n Its Vritions. Volume 12 of Comintoril Optimiztion. Kluwer Aemi Pulishers, Boston, USA (2002) 6. Bixy, B., Reinelt, G.: TSPLIB A lirry of trvelling slesmn n relte prolem instnes. Internet repository (1995) http://omopt.ifi.uniheielerg.e/softwre/tsplib95/. 7. Guroi Optimiztion, In.: Guroi Optimizer Referene Mnul, Version 2.0, http://www.guroi.om. (2010)