Newsgroups: comp.ai.genetic
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!europa.eng.gtefsd.com!howland.reston.ans.net!EU.net!uunet!hearst.acc.Virginia.EDU!murdoch!mamba.cs.Virginia.EDU!rcc6p
From: rcc6p@mamba.cs.Virginia.EDU (Robert C. Craighurst)
Subject: Re: TSP Crossover function
Message-ID: <CxxFrH.C7u@murdoch.acc.Virginia.EDU>
Sender: usenet@murdoch.acc.Virginia.EDU
Organization: University of Virginia Computer Science Department
References: <381o3r$2cg@hptemp1.cc.umr.edu>
Date: Wed, 19 Oct 1994 15:45:17 GMT
Lines: 51

In article <381o3r$2cg@hptemp1.cc.umr.edu> mkelly@albert (Mark LeRoy Kelly) writes:
>Please help asap... I need to know a simple (not neccessarily efficient)
>method of crossing over two city list solutions to a traveling salesman
>problem.  I am writing a small code for a take home exam (yes, it is
>Ok for us to get outside help).
...
>thanks,
>mkelly@albert.nuc.umr.edu 
....................

I use something called a Maximal Preservative Crossover, or MPX, which
I saw described in papers by Martina Gorges-Schluter: "Explicit 
Parallelism of Genetic Algorithms through Population Structures" 
and "ASPARAGOS An Asynchrounous Parallel Genetic Optimization Strategy." 
(The following description of MPX is mine.)

  Assume a 10-city tour and two parent individuals, Mom and Dad.

    Mom:  1-2-3-4-5-6-7-8-9-0-
    Dad:  3-5-7-1-9-4-6-8-0-2-

The final "-" represents a wrap back to the first city.

Mom chooses a random segment of her tour, say 5-6-7-8-9 and announces
the end points, 5 and 9.  Dad rearranges his tour to bring those two
end points together.  He does so by reversing the segement between
those two end points in his tour.  In our example he has two choices.
Either he can reverse 5-7-1 to produce 3-*1-7-5*-9-4-6-8-0-2-or he
can reverse 7-1-9 to produce 3-5-*9-1-7*-4-6-8-0-2-.  (Segments in
question highlighted by asterisks.)  In either case, 5 and 9 become
adjacent.  Next he inserts Mom's segment into his tour, aligned on
the end points.  The interim result is 3-*5-6-7-8-9*-1-7-4-6-8-0-2-,
with Mom's donation surrounded by asterisks.  This result is not,
however, a legal tour.  Cities,  6,7,and 8 are visited twice.  By
removing these cities from Dad's original tour we get
3-5-6-7-8-9-1-4-0-2-.  This tour becomes the new offspring.  The
parents retain their original tours and the crossover process is
complete.

.....

There are other ways to do a tsp crossover, of course.

Good luck on your exam.

-- Rob
-- 
-- Rob Craighurst   --   rcc6p@virginia.edu    --   CS Dept, UVa ---
CRAIGHURST'S   | For a given portion of any food, F, there exists quantities
LAW OF COOKING | G and B of garlic and butter such that F + G + B tastes good.

