The Traveling Salesman Starring: Mr. Brute Force Co Starring: Mrs. Sorted Edge Lord Nearest Neighbor.

Slides:



Advertisements
Similar presentations
Chapter 2: Business Efficiency Lesson Plan
Advertisements

Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
1 Chapter 15.3 Hamilton Paths and Hamilton Circuits Objectives 1.Understand the definitions of Hamilton paths & Hamilton circuits. 2.Find the number of.
Excursions in Modern Mathematics(Tannenbaum) and Thinking Mathematically (Blitzer)
9.2 The Traveling Salesman Problem. Let us return to the question of finding a cheapest possible cycle through all the given towns: We have n towns (points)
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
7.3 Kruskal’s Algorithm. Kruskal’s Algorithm was developed by JOSEPH KRUSKAL.
1 Greedy Algorithms. 2 2 A short list of categories Algorithm types we will consider include: Simple recursive algorithms Backtracking algorithms Divide.
§ Algorithms, Algorithms, Algorithms Recall that an algorithm is a set of procedures or rules that, when followed, lead to a ‘solution’ to.
A traveling salesman has customers in 5 cities which we will call A, B, C, D, and E. The salesman needs to travel to all 5 cities with his trip starting.
The Mathematics of Networks Chapter 7. Trees A tree is a graph that –Is connected –Has no circuits Tree.
The Travelling Salesman Algorithm A Salesman has to visit lots of different stores and return to the starting base On a graph this means visiting every.
Chapter 2: Business Efficiency Lesson Plan Business Efficiency  Visiting Vertices-Graph Theory Problem Hamiltonian Circuits  Vacation Planning Problem.
Lecture 23. Greedy Algorithms
Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
SPANNING TREES Lecture 21 CS2110 – Spring
IT 60101: Lecture #201 Foundation of Computing Systems Lecture 20 Classic Optimization Problems.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits.
Slide Copyright © 2009 Pearson Education, Inc. AND Active Learning Lecture Slides For use with Classroom Response Systems Chapter 14 Graph Theory.
Graph Theory Hamilton Paths and Hamilton Circuits.
Spring 2015 Mathematics in Management Science Network Problems Networks & Trees Minimum Networks Spanning Trees Minimum Spanning Trees.
The Traveling-Salesman Problem. Born August 4, 1805 in Dublin, Ireland Died September 2, 1865 in Dublin, Ireland Made many contributions to the Physics.
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
© 2010 Pearson Prentice Hall. All rights reserved. 1 §15.3, Hamilton Paths and Circuits.
Spring 2015 Mathematics in Management Science Traveling Salesman Problem Approximate solutions for TSP NNA, RNN, SEA Greedy Heuristic Algorithms.
Copyright © 2014, 2010, 2007 Pearson Education, Inc. Section 4.2, Slide 1 4 Graph Theory (Networks) The Mathematics of Relationships 4.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits.
CSE332: Data Abstractions Lecture 24.5: Interlude on Intractability Dan Grossman Spring 2012.
6.4: The Brute-Force Algorithms
Chapter 2: Business Efficiency Lesson Plan Business Efficiency  Visiting Vertices-Graph Theory Problem Hamiltonian Circuits  Vacation Planning Problem.
This opportunity is funded by the United States Department of Education. Award # WEEK 2 – 6/17/13 – 6/21/13 INTRODUCTION TO OPTIMIZATION.
Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
EXCURSIONS IN MODERN MATHEMATICS SIXTH EDITION Peter Tannenbaum 1.
Spring 2015 Mathematics in Management Science Network Problems Networks & Trees Minimum Networks Spanning Trees Minimum Spanning Trees.
Mathematics in Management Science
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Graph Theory Hamilton Paths Hamilton Circuits and.
SPANNING TREES Lecture 20 CS2110 – Fall Spanning Trees  Definitions  Minimum spanning trees  3 greedy algorithms (incl. Kruskal’s & Prim’s)
By: Christophe Dufour Chrishon Adams Mischael Joseph.
I can describe the differences between Hamilton and Euler circuits and find efficient Hamilton circuits in graphs. Hamilton Circuits I can compare and.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where.
Turn in HW and Classwork sheet from last class. You have 10 minutes to complete the warm- up. After the warm-up, we will finish our notes on algorithms.
Spanning Trees Dijkstra (Unit 10) SOL: DM.2 Classwork worksheet Homework (day 70) Worksheet Quiz next block.
Mathematical modeling To describe or represent a real-world situation quantitatively, in mathematical language.
MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support.
Hamilton Paths and Hamilton Circuits
Excursions in Modern Mathematics Sixth Edition
Weighted Graphs and traveling Salesperson problem
Shortest Path Problems
Redraw these graphs so that none of the line intersect except at the vertices B C D E F G H.
HAMILTONIAN CIRCUIT ALGORITHMS
Week 11 - Monday CS221.
Chapter 2: Business Efficiency Lesson Plan
Chapter 2: Business Efficiency Lesson Plan
Section 14.3 Hamilton Paths, and Hamilton Circuits
Quiz Review.
Shortest Path.
Advanced Analysis of Algorithms
Warm Up – Friday.
A path that uses every vertex of the graph exactly once.
Cheapest-Link Algorithm/Sorted Edges (Unit 10) SOL: DM.2
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Classwork Worksheet Homework (day 67) worksheet
Hamilton Paths and Hamilton Circuits
Warm Up – Monday Calculate the Redundancy of the above network.
Traveling Salesman Problems Nearest Neighbor Method
Presentation transcript:

The Traveling Salesman Starring: Mr. Brute Force Co Starring: Mrs. Sorted Edge Lord Nearest Neighbor

The Problem: As you approach the legal driving age you realize you need to start earning some money so that you won’t have to rely on your tricycle any more. You decide to go into business for yourself and start your own paper route. You start small, with only 3 customers.

The Problem: The following table represents the time, in minutes, for you to ride you tricycle between each of your customer homes, and yours.

The Problem: HomeAldoButchCassidy Home Aldo6--89 Butch Cassidy5913--

The Problem: Create a program that will display the shortest (time-wise) route for you to take.

Algorithms to code: Brute Force: Create a Tree diagram, analyzing all possible paths and pick the shortest.

Algorithms to code: Nearest Neighbor: Starting from Home, go to the “nearest” neighbor (the neighbor whose house is closest), and then to that person’s “nearest” neighbor, and so on, until it is time to return home. No customer can be visited twice.

Algorithms to code: Sorted-Edges / Cheapest-Link: Select paths one at a time, always selecting the “cheapest” path. Continue in this manner, unless picking a path will “close” your route (close a circuit) before reaching all your customers, or it will be a third path/edge chosen to a customer’s house.

The user will select the algorithm to be used. Your home and your customers are mathematically represented by a graph, or a network of vertices and edges connecting the vertices. One possible graph representing the above situation is pictured

Upgrades: User selects start location. Not all locations are connected File I/O for larger networks.

Brute Force:

The first and last paths are the shortest, each taking 32 minutes. Note that the order of H-A-B-C-H is the reverse of H-C-B-A-H

Nearest Neighbor: Start at HOME Look for Shortest Path and take it From the new location, look for the shortest path left and take it Then, select the next shortest path (unless it takes you home before all locations have been visited) If there are no other locations to visit, go home Sum up the time for all paths taken

The Nearest-Neighbor Algorithm yields a path of H-C-A-B-H or H-B-A-C-H. Note that these paths are 34 minutes long – this is not the optimal solution, but still a good solution.

Sorted-Edges / Cheapest Link: Start by sorting the edges smallest to largest

Sorted-Edges / Cheapest Link: Go down the list, selecting the shortest available path that does not close a circuit (unless you’re done) and it is not the third path/edge leading to a customer/vertex.

Sorted-Edges / Cheapest Link: Note that this algorithm produced a path of H-A-B-C-H (or H-C-B-A-H) which takes 32 minutes and is our optimal path.

Your Task is to implement the Nearest Neighbor & Sorted Edges algorithms Maximum points will be awarded for those who implement an algorithm that provides for a dynamically set of locations We will modify this project to make use of file I/O after our next lecture topic is covered