Intro to Contemporary Math

Similar documents
Warm-up Find the shortest trip (total distance) starting and ending in Chicago and visiting each other city once.

Traveling Salesman Problem (TSP) - Visit every city and then go home.

Check off these skills when you feel that you have mastered them. Write in your own words the definition of a Hamiltonian circuit.

Intro to Contemporary Math

Algorithm Design Strategies V

A path that visits each vertex exactly once is a Hamiltonian path. A circuit that visits each vertex exactly once is a Hamiltonian circuit.

A path that visits each vertex exactly once is a path

8.3 Hamiltonian Paths and Circuits

Data Structures and Algorithms (CSCI 340)

Introductory Probability

P, NP, NP-Complete. Ruth Anderson

Circuits. CSE 373 Data Structures

Data Structures in Java

2 Notation and Preliminaries

Data Structures in Java. Session 22 Instructor: Bert Huang

Mathematical Thinking Exam 2 20 November 2017

P versus NP. Math 40210, Spring September 16, Math (Spring 2012) P versus NP September 16, / 9

CS/COE

Chapter 2. Business Efficiency. Chapter Outline. Chapter Summary

1 Heuristics for the Traveling Salesman Problem

Hamiltonian Cycle. Zero Knowledge Proof

NP-Complete Problems. More reductions

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

NP-Completeness. Until now we have been designing algorithms for specific problems

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

Methods for finding optimal configurations

Travelling Salesman Problem

CSCI3390-Lecture 18: Why is the P =?NP Problem Such a Big Deal?

Lecture 24: How to become Famous with P and NP

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Hamiltonian Graphs Graphs

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

P vs NP: Solutions of the Traveling Salesman Problem

CSE 326: Data Structures NP Completeness

P versus NP. Math 40210, Spring April 8, Math (Spring 2012) P versus NP April 8, / 9

Optimization Prof. A. Goswami Department of Mathematics Indian Institute of Technology, Kharagpur. Lecture - 20 Travelling Salesman Problem

Scheduling and Optimization Course (MPRI)

July 18, Approximation Algorithms (Travelling Salesman Problem)

Statistical Machine Translation. Part III: Search Problem. Complexity issues. DP beam-search: with single and multi-stacks

VIII. NP-completeness

Bounds on the Traveling Salesman Problem

Lecture 6 January 21, 2013

Introduction to integer programming III:

Lesson 1: What is a Parabola?

Data Structures and Algorithms

Approximating Shortest Superstring Problem Using de Bruijn Graphs

Nondeterministic Polynomial Time

Methods for finding optimal configurations

Ant Colony Optimization: an introduction. Daniel Chivilikhin

Totally unimodular matrices. Introduction to integer programming III: Network Flow, Interval Scheduling, and Vehicle Routing Problems

6 Euler Circuits and Hamiltonian Cycles

D1 Discrete Mathematics The Travelling Salesperson problem. The Nearest Neighbour Algorithm The Lower Bound Algorithm The Tour Improvement Algorithm

Chapter 34: NP-Completeness

CSCI3390-Lecture 17: A sampler of NP-complete problems

Practice Final Solutions. 1. Consider the following algorithm. Assume that n 1. line code 1 alg(n) { 2 j = 0 3 if (n = 0) { 4 return j

Counting Strategies: Inclusion/Exclusion, Categories

WebAssign Lesson 1-1 Basic Hw (Homework)

Unit Calendar. Date Sect. Topic Homework HW On-Time April Direct Variation Page 256: #3-37 odd

ABHELSINKI UNIVERSITY OF TECHNOLOGY

Lecture 15 - NP Completeness 1

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

Institute of Operating Systems and Computer Networks Algorithms Group. Network Algorithms. Tutorial 3: Shortest paths and other stuff

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

Applied Integer Programming: Modeling and Solution

Computational Complexity

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Tractable & Intractable Problems

Unit 1A: Computational Complexity

NP-Complete Problems and Approximation Algorithms

Introduction into Vehicle Routing Problems and other basic mixed-integer problems

Who Has Heard of This Problem? Courtesy: Jeremy Kun

Lecture 15: Genetic Algorithms

NP Completeness and Approximation Algorithms

Trees/Intro to counting

Problem Complexity Classes

Genetic Algorithm approach to Solve Shortest Path and Travelling Salesman Problem

Theoretical computer science: Turing machines

10.3 Matroids and approximation

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

The quest for finding Hamiltonian cycles

Swarm Intelligence Traveling Salesman Problem and Ant System

Introductory Probability

MATH 22 HAMILTONIAN GRAPHS. Lecture V: 11/18/2003

1 Introduction The Travelling Salesman Problem (TSP) and in general vehicle routing and scheduling problems have been widely studied for more than thr

Be ready to take a few more Notes (Chapter 10 Section 3) Chapter 10 Quiz next Tuesday. If you were absent yesterday - graph review page - Exit ticket

Lecture 4: NP and computational intractability

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

We ll start today by learning how to change a repeating decimal into a fraction! Then we will do a review of Unit 1 - half of Unit 3!

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Covers: Midterm Review

Counting Strategies: Inclusion-Exclusion, Categories

Unit 7 Day 4 Section 4.5 & Practice Hamiltonian Circuits and Paths

Correctness of Dijkstra s algorithm

Counting Strategies: Inclusion/Exclusion, Categories

HOMEWORK #2 - MATH 3260

Traveling Salesman Problem

Central Tendency & Graphs of Data Long-Term Memory Review Grade 7, Standard 5.0 Review 1

Introductory Probability

Transcription:

Intro to Contemporary Math Hamiltonian Circuits and Nearest Neighbor Algorithm Nicholas Nguyen nicholas.nguyen@uky.edu Department of Mathematics UK

Agenda Hamiltonian Circuits and the Traveling Salesman Problem Nearest Neighbor Algorithm

Announcements Homework EC is due on Saturday

Hamiltonian Circuit A circuit on a graph is a Hamiltonian circuit if it: starts and ends at the same vertex visits every other vertex on the graph does not repeat vertices

Traveling Salesman Problem Given a connected graph with weights, how do we nd the Hamiltonian circuit with the lowest total weight? Application: A salesman must y out on a trip to some cities, and then return home. In what order should he visit the cities to minimize the cost of travel?

Hamiltonian Circuit Example Start at A, visit other vertices, and end at A. Circuit: A, B, C, D, E, A

Hamiltonian Circuit Example Circuit: A, B, C, D, E, A

Hamiltonian Circuit Example Circuit: A, B, C, D, E, A

Hamiltonian Circuit Example Circuit: A, B, C, D, E, A

Hamiltonian Circuit Example Circuit: A, B, C, D, E, A

Hamiltonian Circuit Example Circuit: A, B, C, D, E, A (return)

?(7.1) Total Weight What is the total weight? Type and send a number.

Total Weight 11 + 10 + 18 + 12 + 14 = 65

Nearest Neighbor Algorithm Goal: Find the shortest Hamiltonian circuit Step 1: Pick a starting vertex. Step 2: Move to the nearest unvisited vertex (along the edge with the lowest weight). Step 3: Repeat Step 2 until the circuit is complete: once you have visited all other vertices, go back to the starting vertex.

Nearest Neighbor Demo Use the Nearest Neighbor Algorithm starting at E. Record the vertices in the order you follow them and nd the total weight of the circuit. Circuit: E,,,,, E. In class, when you see a?(7.#) in the upper left corner, press the label of the vertex (A-E) we should go to next according to the algorithm.

?(7.2) Next? Press the letter of the next vertex in the circuit.

Cheapest edge at E is 8 (goes to B)

?(7.3) Next? Cheapest edge at E is 8 (goes to B) Type the next vertex.

Cheapest edge at B that leads to a new vertex is 10 (to C).

?(7.4) Next? Cheapest edge at B that leads to a new vertex is 10 (to C). Type the next vertex.

Cheapest edge at C that leads to a new vertex is 18 (to D).

?(7.5) Next? Cheapest edge at C that leads to a new vertex is 18 (to D). Type the next vertex.

Do not use 12 and 17 edges. They lead to previous vertices.

Cheapest edge at D that leads to a new vertex is 20 (to A).

?(7.6) Next? Cheapest edge at D that leads to a new vertex is 20 (to A). Type the next vertex.

Return to Start! E, B, C, D, A, E At A, take 14 edge back to E to nish the circuit.

?(7.7) Total Weight Type and send a number.

E, B, C, D, A, E Total weight: 8 + 10 + 18 + 20 + 14 = 70

?(7.8) Shortest Hamiltonian Circuit Is E, B, C, D, A, E, the circuit Nearest Neighbor found, the shortest Hamiltonian circuit on this graph? Yes, or No?

Shortest Hamiltonian Circuit Is E, B, C, D, A, E, the circuit Nearest Neighbor found, the shortest Hamiltonian circuit on this graph? No! E, B, C, D, A, E has total weight 70 The one we found earlier, A, B, C, D, E, A, was shorter, with total weight 65.

Nearest Neighbor Algorithm Evaluation The Nearest Neighbor Algorithm is: Not Optimal: It might not get the circuit with the lowest total weight Ecient: It gives an answer quickly The Nearest Neighbor Algorithm is a heuristic algorithm. It is fast, and while its answer is not the best, it is still good.

Next Time Sorted Edges Algorithm