170 likes | 313 Views
Applications of Genetic Algorithms. Amy Hoover. Actual GA Applications. Software Bug Repair http://www.genetic-programming.org/hc2009/1-Forrest/Forrest-Presentation.pdf Weapon Design in Video Games gar.eecs.ucf.edu Radar coverage. Traveling Salesman Problem.
E N D
Applications of Genetic Algorithms Amy Hoover
Actual GA Applications • Software Bug Repair • http://www.genetic-programming.org/hc2009/1-Forrest/Forrest-Presentation.pdf • Weapon Design in Video Games • gar.eecs.ucf.edu • Radar coverage
Traveling Salesman Problem • Problem: You want to mine the most gold in the least amount of time. • What’s the best route? B C A E D
Traveling Salesman Problem • Problem: You want to mine the most gold in the least amount of time. • What’s the best route? 4min 4min B C A 5min 2min 2min 7min 3min E 6min D
What’s the best route? 4min 4min B C A 5min 2min 2min 7min 3min E 6min D Path 1: ABCDE How long would this take? Path 2: ABDEC How long would this take?
What’s the best route? 4min 4min B C A 2min 5min 2min 7min 3min E 6min D Path 1: ABCDE A-B = 4min, B-C = 4min, C-D = 3 min, D-E = 6 min 4 + 4 + 3 + 6 = 17 minutes to mine all the gold! Path 2: ABDEC (Class) How long would this take
What’s the best route? 4min 4min B C A 5min 2min 2min 7min 3min E 6min D Path 1: ABCDE A-B = 4min, B-C = 4min, C-D = 3 min, D-E = 6 min 4 + 4 + 3 + 6 = 17 minutes to mine all the gold! Path 2: ABDEC A-B = 4min, B-D = 5min, D-E = 6 min, E-C = 7 min 4 + 5 + 6 + 7 = 22 minutes to mine all the gold Which path is better?
Problem • Search space grows enormously with each visited node • nodeCount!
Traveling Salesman and GAs • Example GA • http://dandeblasio.com/cot4810/ • How can we encode this using GAs?
Traveling Salesman and GAs • How can we encode this using GAs? • Need chromosome!
Traveling Salesman and GAs • How can we encode this using GAs? • Need chromosome! • Path = ABCDE • Then what?
Traveling Salesman and GAs • How can we encode this using GAs? • Need chromosome! • Path = ABCDE • Then what? • Randomize the initial population! • Path 1 = ABCDE • Path 2 = ABCED • Path 3 = ABECD • Path 4 = AEBCD • Path 5 = EABCD … • Then what?
Traveling Salesman and GAs • How can we encode this using GAs? • Calculate the fitness of each individual • Path 1 = ABCDE = ? • Path 2 = ABCED = ? • Path 3 = ABECD = ? • Path 4 = AEBCD = ? • Path 5 = EABCD = ?
Traveling Salesman and GAs • How can we encode this using GAs? • Calculate the fitness of each individual • Keep in mind we want to get the most gold in the LEAST amount of time so we can go do other fun stuff • Path 1 = ABCDE = 17 minutes • Path 2 = ABCED = 22 minutes • Fitness = 100 – 22 = 78 • Path 3 = ABECD = 4 +2 + 7 + 3 = 16 minutes • Path 4 = AEBCD = 2 + 2 +4 + 3 = 11 minutes • Fitness = 100 - 11 = 89 • Path 5 = EABCD = 2 + 4 + 4 + 3 = 13 minutes
Traveling Salesman and GAs • How can we encode this using GAs? • Calculate the fitness of each individual • Keep in mind we want to get the most mithril in the LEAST amount of time so we can go do other fun stuff • Path 1 = ABCDE = 17 minutes • Path 2 = ABCED = 22 minutes • Path 3 = ABECD = 4 +2 + 7 + 3 = 16 minutes • Path 4 = AEBCD = 2 + 2 +4 + 3 = 11 minutes • Path 5 = EABCD = 2 + 4 + 4 + 3 = 13 minutes
Traveling Salesman and GAs • Who should reproduce? • Path 1 = ABCDE = 17 minutes • Path 2 = ABCED = 22 minutes • Path 3 = ABECD = 4 +2 + 7 + 3 = 16 minutes • Path 4 = AEBCD = 2 + 2 +4 + 3 = 11 minutes • Path 5 = EABCD = 2 + 4 + 4 + 3 = 13 minutes
Problems Arise With Crossover (A doesn’t have 2 sets of gold!) • “ABCDEF” “ABCFAE” • “CDBFAE” “CDBDEF” • 2 Options • Modify Our Representation • Modify Our Crossover Operator