1 / 19

Transporting Perishable Goods (ANEB-TSP)

Transporting Perishable Goods (ANEB-TSP). The Art of Implementing an EA Assignment 1 CS 348 Fall 2008. 1. 7. 10. 12. 14. 8. 2. 4. 6. 12. 3. 15. 11. Travel Time (hours). 5. Asymmetric Non-Euclidean Bottleneck TSP. 1. 7. 10. 2. 4. 12. 14. 3. 8. 6. 12. 15. 11. 5.

tacey
Download Presentation

Transporting Perishable Goods (ANEB-TSP)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Transporting Perishable Goods (ANEB-TSP) The Art of Implementing an EA Assignment 1 CS 348 Fall 2008

  2. 1 7 10 12 14 8 2 4 6 12 3 15 11 Travel Time (hours) 5 Asymmetric Non-Euclidean Bottleneck TSP

  3. 1 7 10 2 4 12 14 3 8 6 12 15 11 5 Dataset File Format Number of vertices v e s1 d1 w1 s2 d2 w2 … s<e> d<e> w<e> Number of edges Edge info: Source vertex Destination vertex Edge weight Example: 5 10 1 4 10 4 1 14 4 3 6 3 4 8 3 5 11 5 3 11 …

  4. 1 7 10 2 4 12 14 3 8 6 12 15 11 5 Individual Genotype Representation • Permutations Possible Permutations 1 4 3 5 2 Cycle 1 5 2 1 4 3 Cycle 1 2 5 3 4 1 Cycle 2

  5. 1 4 4 2 2 3 3 5 3 1 1 4 5 6 5 2 6 6 Permutation Creation • Create array • Number in-order • Loop i ← 1 to N • j ← random ≥ i • Swap(A[i], A[j])

  6. Individual Datastructure • A standard EA solution will usually have 2 data members • Genotype • Fitness • Fitness is stored to avoid recalculation • For static problem environments

  7. Fitness Calculation • Find the edge with the largest weight in the trial solution (the permutation) • weights are given in the datafile • Fitness should be inversely proportional to the largest weight • Objective function vs. Fitness function • Ideas • Fitness = - largest weight • Fitness = 1 / largest weight • Highest fitness value will be the best individual

  8. Program Requirements • Read from a configuration file • Complete 1+ runs of the EA • Write information to a log file

  9. Required Parameters in Configuration File • (datafile) Dataset file • (logfile) Log file • (popsize) Population size • (offsize) Offspring per generation • (tournsize) Tournament size • (maxeval) Maximum evaluations • (runs) Number of runs • (seed) Random seed

  10. Initial Setup • Open configuration file • Parse values into variables • Read datafile describing the TSP dataset • Seed random number generator

  11. Random Number Generator • Is a datastructure • Updates internal variables every time a random number is requested • Seed only once • Use quality RNG • the Mersenne Twister • http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html

  12. EA Run • Pass in all configuration data • Create data structures for population/offspring • population[popsize] • offspring[offsize] • Initialize population with random individuals • evalcount = popsize • While(evalcount < maxevals) • For # of children (offsize) • Select two parents by two n-ary tournaments • Recombine using cut-and-crossfill • Mutate offspring • Evaluate child’s fitness (evalcount++) • Sort and elitist survival selection

  13. Parent Selection • Create tournsize random numbers for each parent to be selected (r1 … rn) • Parent 1 • max_fitness(population[r1] ... population[rn]) • Parent 2 • generate new random numbers (t1 … tn) • max_fitness(population[t1] ... population[tn])

  14. 4 3 6 2 1 5 4 2 4 3 3 6 1 1 5 2 6 5 Recombination (“cut-and-crossfill”) Child

  15. Recombination (“cut-and-crossfill”) • Used[] ← boolean array of all false’s • XPoint ← random from 1 to N • For (i ← 1 to XPoint) • Child[i] ← ParentA[i] • Used[Child[i]] ← true • j ← 0 • For (i ← XPoint to N) • While(Used[ParentB[j]]) • j ← j + 1 • Child[i] ← ParentB[j]

  16. Bonus – Implementing Another Recombination Method • Many ways to implement crossover for a permutation • Affects performance of the EA • Examples – Chapter 3 • Partially Mapped Crossover (PMC) • Edge Crossover • Order Crossover • Cycle Crossover

  17. Mutation • i ← random from 1 to N • j ← random from 1 to N • Swap(Child[i], Child[j]) 4 3 6 2 1 5

  18. Truncation Survival Selection • Combine population and offspring into one group • Sort by fitness • Keep the best popsize individuals in the population

  19. Bonus – Compare to a Heuristic • Implement or test a good existing heuristic for the ANEB-TSP • Statistically compare to the EA • Code for the heuristic is due along with the report

More Related