6.4: The Brute-Force Algorithms

Slides:



Advertisements
Similar presentations
Chapter 2: Business Efficiency Lesson Plan
Advertisements

1. Find the cost of each of the following using the Nearest Neighbor Algorithm. a)Start at Vertex M.
6.8 The Cheapest-Link Algorithm. The Cheapest-Link Algorithm Pick the edge with the smallest weight and mark it Pick the next edge with the smallest weight.
Chapter 7 Graph Theory 7.1 Modeling with graphs and finding Euler circuits. Learning Objectives: Know how to use graphs as models and how to determine.
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.
Chapter 4 sec. 2.  A famous and difficult problem to solve in graph theory.
Excursions in Modern Mathematics(Tannenbaum) and Thinking Mathematically (Blitzer)
§ 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.
Traveling Salesman Problems Repetitive Nearest-Neighbor and Cheapest-Link Algorithms Chapter: 6.
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.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits.
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.
Networks.
Chapter 4 sections 1 and 2.  Fig. 1  Not connected  All vertices are even.  Fig. 2  Connected  All vertices are even.
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.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
© 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.
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.
Chapter 2: Business Efficiency Lesson Plan Business Efficiency  Visiting Vertices-Graph Theory Problem Hamiltonian Circuits  Vacation Planning Problem.
 Graphs  Paths  Circuits  Euler. Traveling Salesman Problems.
EXCURSIONS IN MODERN MATHEMATICS SIXTH EDITION Peter Tannenbaum 1.
The Travelling Salesperson Problem A salesperson needs to visit London, Nottingham, Manchester and Leeds, he lives in Birmingham. Find the shortest route.
6.1 Hamilton Circuits and Hamilton Path
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Graph Theory Hamilton Paths Hamilton Circuits and.
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.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 6 The Mathematics of Touring 6.1Hamilton Paths and Hamilton Circuits.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
The Traveling Salesman Starring: Mr. Brute Force Co Starring: Mrs. Sorted Edge Lord Nearest Neighbor.
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.
Chapter 2: Business Efficiency Hamiltonian Circuit Visiting Vertices –In some graph theory problems, it is only necessary to visit specific locations (using.
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
D1 Discrete Mathematics
6.4: The Brute-Force Algorithms
Weighted Graphs and traveling Salesperson problem
HAMILTONIAN CIRCUIT ALGORITHMS
Chapter 2: Business Efficiency Lesson Plan
Chapter 2: Business Efficiency Lesson Plan
Section 14.3 Hamilton Paths, and Hamilton Circuits
* Hamiltonian Circuits introduction
The Travelling Salesperson problem
D1 Discrete Mathematics
6.1 Hamilton Circuits and Hamilton Path
A path that uses every vertex of the graph exactly once.
The travelling salesman problem
Cheapest-Link Algorithm/Sorted Edges (Unit 10) SOL: DM.2
Nearest Neighbor Repetitive Nearest Neighbor (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
Euler circuit Theorem 1 If a graph G has an Eulerian path, then it must have exactly two odd vertices. Theorem 2 If a graph G has an Eulerian circuit,
Traveling Salesman Problems Nearest Neighbor Method
Shortest Route Problems
Presentation transcript:

6.4: The Brute-Force Algorithms List all of the possible Hamilton circuits Calculate the total weights for each of the possible Hamilton circuit Choose an optimal circuit (cheapest, shortest, or fastest…)

The Brute-Force Algorithms A,B,C,D,E,A = 812 A,B,C,E,D,A = 777 A,B,D,C,E,A = 762 A,B,D,E,C,A = 773 A,B,E,C,D,A = 831 A,B,E,D,C,A = 877 A,C,B,D,E,A = 722 A,C,B,E,D,A = 791 A,C,D,B,E,A = 776 A,C,E,B,D,A = 741 A,D,B,C,E,A = 676 A,D,C,B,E,A = 780 There are 5 vertices so we have (5-1)! = 24 Hamilton circuits Optimal route Plus 12 mirror images

The Brute-Force Algorithms Start at C C,A,B,D,C =70+20+10+50=150 C,A,D,B,C =70+30+10+15=125 C,B,A,D,C =15+20+30+50=115 C,B,D,A,C =125 C,D,A,B,C =115 C,D,B,A,C =150 Therefore: optimal circuits are C,B,A,D,C or C,D,A,B,C If the problem asks to start at A then the optimal circuits are A,D,C,B,A or A,B,C,D,A A 20 70 30 C 15 B Mirror images 50 10 D

6.5: The Nearest-Neighbor Algorithm From the starting vertex, go to its nearest neighbor (the edge has the smallest weight) Repeating step 1 with the next vertex and the next vertex until there is no more vertex to visit From the last vertex, return to the starting point

The Nearest-Neighbor Algorithm Start at A, pick AC = 119 From C, pick CE = 120 From E, pick ED = 199 From D, pick DB = 150 No more vertex left so connect B and A, with BA=185 Therefore the trip is: A,C,E,D,B,A = 773 dollars

The Nearest-Neighbor Algorithm Start at C, pick CB = 15 From B, pick BD = 10 From D, pick DA = 30 No more vertex left, so connect A and C, with AC = 70 Therefore, the route is C,B,D,A,C = 125

Practice with the Nearest Neighbor

Apply the Nearest Neighbor Algorithm to find the way to go to the bank, dry cleaner, post office, and Wegmans starting and ending at home. The mileage chart is shown below. D W B P HOME

6.7 The repetitive Nearest-Neighbor Algorithm

The Brute-Force Algorithm: optimal but inefficient algorithm The Nearest-Neighbor Algorithm and Repetitive Nearest-Neighbor: efficient but not optimal algorithms.

The Repetitive Nearest-Neighbor Algorithm Apply the Nearest Neighbor Algorithm to each of the vertices to calculate the total weights. Choose the best circuit. If there is a designated starting vertex, rewrite the circuit using that vertex as the reference point

The Repetitive Nearest-Neighbor Algorithm From A: A, C, E, D, B, A = 773 From B: B, C, A, E, D, B = 722 From C: C, A, E, D, B, C = 722 From D: D, B, C, A, E, D = 722 From E: E, C, A, D, B, E = 741 Therefore, one of the best routes is B, C, A, E, D, B so we rewrite it so the starting point is at A (his home): A, E, D, B, C, A

The Repetitive Nearest-Neighbor Algorithm From A: A, B, D, C, A = 20+10+50+70= 150 From B: B, D, A, C, B = 10+30+70+15= 125 From C: C, B, D, A, C = 15+10+30+70= 125 From D: D, B, C, A, D = 10+15+70+30 = 125 One of the best routes is C,B,D,A,C = 125 or if re-write with starting point A: A,C,B,D,A