The document discusses the travelling salesman problem (TSP) which aims to find the shortest route for a salesman to visit each city in a list only once and return to the origin city. It is an NP-hard problem with many applications. The TSP cannot be solved in polynomial time and is one of the most studied problems in optimization. While computationally difficult, heuristics and algorithms have been developed that can solve instances with tens of thousands of cities and approximate solutions for problems with millions of cities.
The document discusses NP-completeness and algorithms. It introduces dynamic programming and greedy algorithms. It then discusses the activity selection problem and shows it can be solved greedily by choosing the activity with the earliest finish time at each step. Finally, it defines the classes P and NP, introduces the concept of reductions to show problems are NP-complete, and states that if any NP-complete problem can be solved in polynomial time, then P=NP.
P, NP, NP-Complete, and NP-Hard
Reductionism in Algorithms
NP-Completeness and Cooks Theorem
NP-Complete and NP-Hard Problems
Travelling Salesman Problem (TSP)
Travelling Salesman Problem (TSP) - Approximation Algorithms
PRIMES is in P - (A hope for NP problems in P)
Millennium Problems
Conclusions
The document discusses the history and applications of the traveling salesman problem (TSP). It describes how the TSP involves finding the shortest route for a salesman to visit each city in a list only once before returning home. It provides examples of the TSP in route planning and ATM servicing. The document also outlines methods for exactly and approximately solving TSP instances, including using linear programming and heuristics. It gives examples of large TSPs that have been solved involving thousands of cities from real applications in logistics and circuit board design.
The document describes various problem solving concepts including defining a problem, representing the problem space, and searching for solutions. It provides examples of well-defined problems like the 8-puzzle, water jug problem, and missionaries and cannibals problem. It also discusses uninformed search strategies like breadth-first search that search the problem space without heuristics to guide the search. Breadth-first search expands the shallowest nodes first and has guarantees of completeness but not optimality.
Problem solving - A presentation at IIScRinka Singh
The document discusses problem solving and various problem solving tools and techniques. It begins with an example of how a GM engineer solved the problem of a car that wouldn't start after the owner bought ice cream. The engineer analyzed the problem systematically without dismissing it, and determined the real issue was the restart interval.
The document then discusses why problem solving is important, different types of problems, and tools that can be used for problem solving like root cause analysis, TRIZ, brainstorming, and the 6 thinking hats. It provides another example of how Jeff Bezos used a 5Why analysis to solve a safety issue at an Amazon fulfillment center.
Finally, it discusses contradictions as a way to frame problems and how
In 2014 I launched a new course, “Mathematical Foundations of Statistical Software,” in the Harvard Extension school, aimed at students with a solid background in calculus. Lectures were a mixture of proofs and R scripts, all homework was done in R, and students completed two major projects using R. Encouraged by the success of the course, I introduced R as a tool for doing linear algebra in the summer course: “Vectors: a Tool for Teaching Algebra, Geometry, and Trigonometry.” Use of R on the homework was limited to modifying scripts that had been presented in class. Again, the use of R was a success.
Last fall, in a large freshman course in linear algebra, real analysis, and multivariable calculus, I devoted about an hour per week to R scripts, without ever using a single statistical function. The interactive graphical capabilities of R permitted novel illustrations of concepts such as limits, eigenvectors, critical points, and vector fields. Extension students who cross-registered for the course liked the use of R, but the freshmen, when asked to suggest what could be done to improve the course, were almost unanimous in saying “Get rid of R!” The difference in the reaction of adult learners and freshmen, tested by doing a permutation test in R, is significant with a P-value of .01.
The document discusses the travelling salesman problem (TSP) which aims to find the shortest route for a salesman to visit each city in a list only once and return to the origin city. It is an NP-hard problem with many applications. The TSP cannot be solved in polynomial time and is one of the most studied problems in optimization. While computationally difficult, heuristics and algorithms have been developed that can solve instances with tens of thousands of cities and approximate solutions for problems with millions of cities.
The document discusses NP-completeness and algorithms. It introduces dynamic programming and greedy algorithms. It then discusses the activity selection problem and shows it can be solved greedily by choosing the activity with the earliest finish time at each step. Finally, it defines the classes P and NP, introduces the concept of reductions to show problems are NP-complete, and states that if any NP-complete problem can be solved in polynomial time, then P=NP.
P, NP, NP-Complete, and NP-Hard
Reductionism in Algorithms
NP-Completeness and Cooks Theorem
NP-Complete and NP-Hard Problems
Travelling Salesman Problem (TSP)
Travelling Salesman Problem (TSP) - Approximation Algorithms
PRIMES is in P - (A hope for NP problems in P)
Millennium Problems
Conclusions
The document discusses the history and applications of the traveling salesman problem (TSP). It describes how the TSP involves finding the shortest route for a salesman to visit each city in a list only once before returning home. It provides examples of the TSP in route planning and ATM servicing. The document also outlines methods for exactly and approximately solving TSP instances, including using linear programming and heuristics. It gives examples of large TSPs that have been solved involving thousands of cities from real applications in logistics and circuit board design.
The document describes various problem solving concepts including defining a problem, representing the problem space, and searching for solutions. It provides examples of well-defined problems like the 8-puzzle, water jug problem, and missionaries and cannibals problem. It also discusses uninformed search strategies like breadth-first search that search the problem space without heuristics to guide the search. Breadth-first search expands the shallowest nodes first and has guarantees of completeness but not optimality.
Problem solving - A presentation at IIScRinka Singh
The document discusses problem solving and various problem solving tools and techniques. It begins with an example of how a GM engineer solved the problem of a car that wouldn't start after the owner bought ice cream. The engineer analyzed the problem systematically without dismissing it, and determined the real issue was the restart interval.
The document then discusses why problem solving is important, different types of problems, and tools that can be used for problem solving like root cause analysis, TRIZ, brainstorming, and the 6 thinking hats. It provides another example of how Jeff Bezos used a 5Why analysis to solve a safety issue at an Amazon fulfillment center.
Finally, it discusses contradictions as a way to frame problems and how
In 2014 I launched a new course, “Mathematical Foundations of Statistical Software,” in the Harvard Extension school, aimed at students with a solid background in calculus. Lectures were a mixture of proofs and R scripts, all homework was done in R, and students completed two major projects using R. Encouraged by the success of the course, I introduced R as a tool for doing linear algebra in the summer course: “Vectors: a Tool for Teaching Algebra, Geometry, and Trigonometry.” Use of R on the homework was limited to modifying scripts that had been presented in class. Again, the use of R was a success.
Last fall, in a large freshman course in linear algebra, real analysis, and multivariable calculus, I devoted about an hour per week to R scripts, without ever using a single statistical function. The interactive graphical capabilities of R permitted novel illustrations of concepts such as limits, eigenvectors, critical points, and vector fields. Extension students who cross-registered for the course liked the use of R, but the freshmen, when asked to suggest what could be done to improve the course, were almost unanimous in saying “Get rid of R!” The difference in the reaction of adult learners and freshmen, tested by doing a permutation test in R, is significant with a P-value of .01.
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
The Rising Future of CPaaS in the Middle East 2024Yara Milbes
Explore "The Rising Future of CPaaS in the Middle East in 2024" with this comprehensive PPT presentation. Discover how Communication Platforms as a Service (CPaaS) is transforming communication across various sectors in the Middle East.
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...kalichargn70th171
Visual testing plays a vital role in ensuring that software products meet the aesthetic requirements specified by clients in functional and non-functional specifications. In today's highly competitive digital landscape, users expect a seamless and visually appealing online experience. Visual testing, also known as automated UI testing or visual regression testing, verifies the accuracy of the visual elements that users interact with.
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceICS
This webinar explores the “secure-by-design” approach to medical device software development. During this important session, we will outline which security measures should be considered for compliance, identify technical solutions available on various hardware platforms, summarize hardware protection methods you should consider when building in security and review security software such as Trusted Execution Environments for secure storage of keys and data, and Intrusion Detection Protection Systems to monitor for threats.
Consistent toolbox talks are critical for maintaining workplace safety, as they provide regular opportunities to address specific hazards and reinforce safe practices.
These brief, focused sessions ensure that safety is a continual conversation rather than a one-time event, which helps keep safety protocols fresh in employees' minds. Studies have shown that shorter, more frequent training sessions are more effective for retention and behavior change compared to longer, infrequent sessions.
Engaging workers regularly, toolbox talks promote a culture of safety, empower employees to voice concerns, and ultimately reduce the likelihood of accidents and injuries on site.
The traditional method of conducting safety talks with paper documents and lengthy meetings is not only time-consuming but also less effective. Manual tracking of attendance and compliance is prone to errors and inconsistencies, leading to gaps in safety communication and potential non-compliance with OSHA regulations. Switching to a digital solution like Safelyio offers significant advantages.
Safelyio automates the delivery and documentation of safety talks, ensuring consistency and accessibility. The microlearning approach breaks down complex safety protocols into manageable, bite-sized pieces, making it easier for employees to absorb and retain information.
This method minimizes disruptions to work schedules, eliminates the hassle of paperwork, and ensures that all safety communications are tracked and recorded accurately. Ultimately, using a digital platform like Safelyio enhances engagement, compliance, and overall safety performance on site. https://safelyio.com/
How GenAI Can Improve Supplier Performance Management.pdfZycus
Data Collection and Analysis with GenAI enables organizations to gather, analyze, and visualize vast amounts of supplier data, identifying key performance indicators and trends. Predictive analytics forecast future supplier performance, mitigating risks and seizing opportunities. Supplier segmentation allows for tailored management strategies, optimizing resource allocation. Automated scorecards and reporting provide real-time insights, enhancing transparency and tracking progress. Collaboration is fostered through GenAI-powered platforms, driving continuous improvement. NLP analyzes unstructured feedback, uncovering deeper insights into supplier relationships. Simulation and scenario planning tools anticipate supply chain disruptions, supporting informed decision-making. Integration with existing systems enhances data accuracy and consistency. McKinsey estimates GenAI could deliver $2.6 trillion to $4.4 trillion in economic benefits annually across industries, revolutionizing procurement processes and delivering significant ROI.
A neural network is a machine learning program, or model, that makes decisions in a manner similar to the human brain, by using processes that mimic the way biological neurons work together to identify phenomena, weigh options and arrive at conclusions.
14 th Edition of International conference on computer visionShulagnaSarkar2
About the event
14th Edition of International conference on computer vision
Computer conferences organized by ScienceFather group. ScienceFather takes the privilege to invite speakers participants students delegates and exhibitors from across the globe to its International Conference on computer conferences to be held in the Various Beautiful cites of the world. computer conferences are a discussion of common Inventions-related issues and additionally trade information share proof thoughts and insight into advanced developments in the science inventions service system. New technology may create many materials and devices with a vast range of applications such as in Science medicine electronics biomaterials energy production and consumer products.
Nomination are Open!! Don't Miss it
Visit: computer.scifat.com
Award Nomination: https://x-i.me/ishnom
Conference Submission: https://x-i.me/anicon
For Enquiry: Computer@scifat.com
The Rising Future of CPaaS in the Middle East 2024Yara Milbes
Explore "The Rising Future of CPaaS in the Middle East in 2024" with this comprehensive PPT presentation. Discover how Communication Platforms as a Service (CPaaS) is transforming communication across various sectors in the Middle East.
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...kalichargn70th171
Visual testing plays a vital role in ensuring that software products meet the aesthetic requirements specified by clients in functional and non-functional specifications. In today's highly competitive digital landscape, users expect a seamless and visually appealing online experience. Visual testing, also known as automated UI testing or visual regression testing, verifies the accuracy of the visual elements that users interact with.
Secure-by-Design Using Hardware and Software Protection for FDA ComplianceICS
This webinar explores the “secure-by-design” approach to medical device software development. During this important session, we will outline which security measures should be considered for compliance, identify technical solutions available on various hardware platforms, summarize hardware protection methods you should consider when building in security and review security software such as Trusted Execution Environments for secure storage of keys and data, and Intrusion Detection Protection Systems to monitor for threats.
Consistent toolbox talks are critical for maintaining workplace safety, as they provide regular opportunities to address specific hazards and reinforce safe practices.
These brief, focused sessions ensure that safety is a continual conversation rather than a one-time event, which helps keep safety protocols fresh in employees' minds. Studies have shown that shorter, more frequent training sessions are more effective for retention and behavior change compared to longer, infrequent sessions.
Engaging workers regularly, toolbox talks promote a culture of safety, empower employees to voice concerns, and ultimately reduce the likelihood of accidents and injuries on site.
The traditional method of conducting safety talks with paper documents and lengthy meetings is not only time-consuming but also less effective. Manual tracking of attendance and compliance is prone to errors and inconsistencies, leading to gaps in safety communication and potential non-compliance with OSHA regulations. Switching to a digital solution like Safelyio offers significant advantages.
Safelyio automates the delivery and documentation of safety talks, ensuring consistency and accessibility. The microlearning approach breaks down complex safety protocols into manageable, bite-sized pieces, making it easier for employees to absorb and retain information.
This method minimizes disruptions to work schedules, eliminates the hassle of paperwork, and ensures that all safety communications are tracked and recorded accurately. Ultimately, using a digital platform like Safelyio enhances engagement, compliance, and overall safety performance on site. https://safelyio.com/
How GenAI Can Improve Supplier Performance Management.pdfZycus
Data Collection and Analysis with GenAI enables organizations to gather, analyze, and visualize vast amounts of supplier data, identifying key performance indicators and trends. Predictive analytics forecast future supplier performance, mitigating risks and seizing opportunities. Supplier segmentation allows for tailored management strategies, optimizing resource allocation. Automated scorecards and reporting provide real-time insights, enhancing transparency and tracking progress. Collaboration is fostered through GenAI-powered platforms, driving continuous improvement. NLP analyzes unstructured feedback, uncovering deeper insights into supplier relationships. Simulation and scenario planning tools anticipate supply chain disruptions, supporting informed decision-making. Integration with existing systems enhances data accuracy and consistency. McKinsey estimates GenAI could deliver $2.6 trillion to $4.4 trillion in economic benefits annually across industries, revolutionizing procurement processes and delivering significant ROI.
A neural network is a machine learning program, or model, that makes decisions in a manner similar to the human brain, by using processes that mimic the way biological neurons work together to identify phenomena, weigh options and arrive at conclusions.
Building API data products on top of your real-time data infrastructureconfluent
This talk and live demonstration will examine how Confluent and Gravitee.io integrate to unlock value from streaming data through API products.
You will learn how data owners and API providers can document, secure data products on top of Confluent brokers, including schema validation, topic routing and message filtering.
You will also see how data and API consumers can discover and subscribe to products in a developer portal, as well as how they can integrate with Confluent topics through protocols like REST, Websockets, Server-sent Events and Webhooks.
Whether you want to monetize your real-time data, enable new integrations with partners, or provide self-service access to topics through various protocols, this webinar is for you!
Stork Product Overview: An AI-Powered Autonomous Delivery FleetVince Scalabrino
Imagine a world where instead of blue and brown trucks dropping parcels on our porches, a buzzing drove of drones delivered our goods. Now imagine those drones are controlled by 3 purpose-built AI designed to ensure all packages were delivered as quickly and as economically as possible That's what Stork is all about.
Photoshop Tutorial for Beginners (2024 Edition)alowpalsadig
Photoshop Tutorial for Beginners (2024 Edition)
Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."
Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
Photoshop Tutorial for Beginners (2024 Edition)Explore the evolution of programming and software development and design in 2024. Discover emerging trends shaping the future of coding in our insightful analysis."Here's an overview:Introduction: The Evolution of Programming and Software DevelopmentThe Rise of Artificial Intelligence and Machine Learning in CodingAdopting Low-Code and No-Code PlatformsQuantum Computing: Entering the Software Development MainstreamIntegration of DevOps with Machine Learning: MLOpsAdvancements in Cybersecurity PracticesThe Growth of Edge ComputingEmerging Programming Languages and FrameworksSoftware Development Ethics and AI RegulationSustainability in Software EngineeringThe Future Workforce: Remote and Distributed TeamsConclusion: Adapting to the Changing Software Development LandscapeIntroduction: The Evolution of Programming and Software Development
The importance of developing and designing programming in 2024
Programming design and development represents a vital step in keeping pace with technological advancements and meeting ever-changing market needs. This course is intended for anyone who wants to understand the fundamental importance of software development and design, whether you are a beginner or a professional seeking to update your knowledge.
Course objectives:
1. **Learn about the basics of software development:
- Understanding software development processes and tools.
- Identify the role of programmers and designers in software projects.
2. Understanding the software design process:
- Learn about the principles of good software design.
- Discussing common design patterns such as Object-Oriented Design.
3. The importance of user experience (UX) in modern software:
- Explore how user experience can improve software acceptance and usability.
- Tools and techniques to analyze and improve user experience.
4. Increase efficiency and productivity through modern development tools:
- Access to the latest programming tools and languages used in the industry.
- Study live examples of applications
Ensuring Efficiency and Speed with Practical Solutions for Clinical OperationsOnePlan Solutions
Clinical operations professionals encounter unique challenges. Balancing regulatory requirements, tight timelines, and the need for cross-functional collaboration can create significant internal pressures. Our upcoming webinar will introduce key strategies and tools to streamline and enhance clinical development processes, helping you overcome these challenges.
What is Continuous Testing in DevOps - A Definitive Guide.pdfkalichargn70th171
Once an overlooked aspect, continuous testing has become indispensable for enterprises striving to accelerate application delivery and reduce business impacts. According to a Statista report, 31.3% of global enterprises have embraced continuous integration and deployment within their DevOps, signaling a pervasive trend toward hastening release cycles.
Software Test Automation - A Comprehensive Guide on Automated Testing.pdfkalichargn70th171
Moving to a more digitally focused era, the importance of software is rapidly increasing. Software tools are crucial for upgrading life standards, enhancing business prospects, and making a smart world. The smooth and fail-proof functioning of the software is very critical, as a large number of people are dependent on them.
WMF 2024 - Unlocking the Future of Data Powering Next-Gen AI with Vector Data...Luigi Fugaro
Vector databases are transforming how we handle data, allowing us to search through text, images, and audio by converting them into vectors. Today, we'll dive into the basics of this exciting technology and discuss its potential to revolutionize our next-generation AI applications. We'll examine typical uses for these databases and the essential tools
developers need. Plus, we'll zoom in on the advanced capabilities of vector search and semantic caching in Java, showcasing these through a live demo with Redis libraries. Get ready to see how these powerful tools can change the game!
Enhanced Screen Flows UI/UX using SLDS with Tom KittPeter Caitens
Join us for an engaging session led by Flow Champion, Tom Kitt. This session will dive into a technique of enhancing the user interfaces and user experiences within Screen Flows using the Salesforce Lightning Design System (SLDS). This technique uses Native functionality, with No Apex Code, No Custom Components and No Managed Packages required.
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
algorithm_8beyond_polynomial_running_times.pdf
1. Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
2. Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
3. Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
4. Iris Hui-Ru Jiang Fall 2014
CHAPTER 8
BEYOND POLYNOMIAL
RUNNING TIMES
IRIS H.-R. JIANG
Outline
¨ Content:
¤ Polynomial-time reduction
¤ NP-completeness
¨ Reading:
¤ Chapter 8
Hard problems
2
The Status of the P Versus NP Problem
http://cacm.acm.org/magazines/2009/9/38904-the-status-
of-the-p-versus-np-problem/fulltext
IRIS H.-R. JIANG
Easy vs. Hard
¨ Q: Which problems will we be able to solve in practice?
¨ A working definition.
¤ [Cobham 1964, Edmonds 1965, Rabin 1966] Those with
polynomial-time algorithms.
¨ Desiderata: Classify problems according to those that can be
solved in polynomial-time and those that cannot.
¨ Provably requires exponential-time.
¨ Frustrating news: Huge number of fundamental problems have
defined classification for decades.
¨ Chapter 8: Show that these fundamental problems are
computationally equivalent and appear to be different
manifestations of one really hard problem.
Hard problems
3
IRIS H.-R. JIANG
Decision & Optimization Problems
¨ Decision problems: those having yes/no answers.
¤ MST: Given a graph G=(V, E) and a bound K, is there a spanning
tree with a cost at most K?
¤ TSP: Given a set of cities, distance between each pair of cities,
and a bound B, is there a route that starts and ends at a given
city, visits every city exactly once, and has total distance at most
B?
¨ Optimization problems: those finding a legal configuration
such that its cost is minimum (or maximum).
¤ MST: Given a graph G=(V, E), find the cost of a minimum
spanning tree of G.
¤ TSP: Given a set of cities and that distance between each pair of
cities, find the distance of a “minimum route” starts and ends at a
given city and visits every city exactly once.
¨ Could apply binary search on a decision problem to obtain
solutions to its optimization problem.
¨ Class NP is associated with decision problems.
Hard problems
4
5. IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
6. IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
7. IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
8. IRIS H.-R. JIANG
Traveling Salesman Problem (TSP)
Hard problems
5
Optimal TSP tour
http://www.tsp.gatech.edu
All 13,509 cities in US with a population of at least 500
IRIS H.-R. JIANG
Complexity Classes
¨ Developed by S. Cook and R. Karp in early 1970.
¨ The class P: class of problems that can be solved in polynomial
time in the size of input.
¨ The class NP (Nondeterministic Polynomial): class of problems
that can be verified in polynomial time in the size of input.
¤ P = NP?
¨ The class NP-complete (NPC): A problem Y in NP with the property
that for every problem X in NP, X £p Y.
¨ Theorem: Suppose Y is NPC, then Y is solvable in polynomial time
iff P = NP.
¤ Any NPC problem can be solved in polynomial time Þ All problems
in NP can be solved in polynomial time.
¨ Fundamental question: Do there exist “natural” NPC problems?
Hard problems
6
IRIS H.-R. JIANG
Verification Algorithm and Class NP
¨ Verification algorithm: a 2-argument algorithm A, where one
argument is an input string x and the other is a binary string y
(called a certificate). A verifies x if there exists y s.t. A answers
“yes.”
¨ Ex: The Traveling Salesman Problem (TSP)
¤ Instance: a set of n cities, distance between each pair of cities,
and a bound B.
¤ Question: is there a route that starts and ends at a given city,
visits every city exactly once, and has total distance £ B?
¨ Is TSP Î NP?
¨ Need to check a solution in polynomial time.
¤ Guess a tour (certificate).
¤ Check if the tour visits every city exactly once.
¤ Check if the tour returns to the start.
¤ Check if total distance £ B.
¨ All can be done in O(n) time, so TSP Î NP.
Hard problems
7
IRIS H.-R. JIANG
The First Proved NPC: Circuit Satisfiability
¨ CIRCUIT-SAT:
¤ Q: Given a combinational circuit built out of AND, OR, and NOT
gates, is there a way to set the circuit inputs so that the output is
1?
¤ A: Yes: 1 0 1
Hard problems
8
Ù
Ø
Ù Ú
Ù
Ú
1 0 ? ? ?
output
inputs
hard-coded inputs
9. IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
10. IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
11. IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
12. IRIS H.-R. JIANG
More Hard Computational Problems
¨ Aerospace engineering: optimal mesh partitioning for finite elements.
¨ Biology: protein folding.
¨ Chemical engineering: heat exchanger network synthesis.
¨ Civil engineering: equilibrium of urban traffic flow.
¨ Economics: computation of arbitrage in financial markets with friction.
¨ Electrical engineering: VLSI layout.
¨ Environmental engineering: optimal placement of contaminant sensors.
¨ Financial engineering: find minimum risk portfolio of given return.
¨ Game theory: find Nash equilibrium that maximizes social welfare.
¨ Genomics: phylogeny reconstruction.
¨ Mechanical engineering: structure of turbulence in sheared flows.
¨ Medicine: reconstructing 3-D shape from biplane angiocardiogram.
¨ Operations research: optimal resource allocation.
¨ Physics: partition function of 3-D Ising model in statistical mechanics.
¨ Politics: Shapley-Shubik voting power.
¨ Pop culture: Minesweeper consistency.
¨ Statistics: optimal experimental design.
Hard problems
9
IRIS H.-R. JIANG
Polynomial-Time Reduction (1/2)
¨ Desiderata: Suppose we could solve Y in polynomial-time.
What else could we solve in polynomial time?
¨ Reduction: Problem X polynomial reduces to problem Y if given
an arbitrary instance x of problem X, we can construct an input
y to problem Y in polynomial time such that x is a yes instance
to X iff y is a yes instance of Y.
¤ Notation: X £P Y.
¨ Remarks:
¤ The algorithm for Y is viewed as a black box.
¤ We pay for polynomial time to write down instances sent to this
black box
Hard problems
10
IRIS H.-R. JIANG
Polynomial-Time Reduction (2/2)
¨ Purpose: Classify problems according to relative difficulty.
1. Design algorithms: If X £P Y and Y can be solved in
polynomial-time, then X can also be solved in polynomial
time.
¤ Bipartite matching £P Network flow
2. Establish intractability: If X £P Y and X cannot be solved in
polynomial-time, then Y cannot be solved in polynomial time.
¤ Hamiltonian cycle £P Travelling salesman
3. Establish equivalence: If X £P Y and Y £P X, X ºP Y.
¤ Up to cost of reduction
Hard problems
11
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy I
Hard problems
12
ĩI can’t find an efficient algorithm.
I guess I’m just too dumb.”
Courtesy of Prof. Y.-W. Chang
13. IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
14. IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
15. IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
16. IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy II
Hard problems
13
Courtesy of Prof. Y.-W. Chang
ĩI can’t find an efficient algorithm,
because no such algorithm is possible!”
IRIS H.-R. JIANG
Coping with a “Tough” Problem: Trilogy III
Hard problems
14
Courtesy of Prof. Y.-W. Chang
ȾI can’t find an efficient algorithm,
but neither can all these famous people.”
IRIS H.-R. JIANG
Polynomial Reduction: HC £P TSP
¨ The Hamiltonian Circuit Problem (HC)
¤ Instance: an undirected graph G = (V, E).
¤ Question: is there a cycle in G that includes every vertex exactly
once?
¨ TSP: The Traveling Salesman Problem
¨ Claim: HC £P TSP.
1. Define a function f mapping any HC instance into a TSP instance, and
show that f can be computed in polynomial time.
2. Prove that G has an HC iff the reduced instance has a TSP tour with
distance £ B (x Î HC Û f(x) Î TSP).
Hard problems
15
IRIS H.-R. JIANG
HC £P TSP: Step 1
¨ Define a reduction function f for HC £P TSP.
¤ Given an HC instance G = (V, E) with n vertices
n Create a set of n cities labeled with names in V.
n Assign distance between u and v
n Set bound B = n.
¤ f can be computed in O(V2) time.
Hard problems
16
17. IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f
18. IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f
19. IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f
20. IRIS H.-R. JIANG
HC £P TSP: Step 2
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ x Î HC Þ f(x) Î TSP.
n Suppose the HC is h = <v1, v2, …, vn, v1>. Then, h is also a
tour in the transformed TSP instance.
n The distance of the tour h is n = B since there are n
consecutive edges in E, and so has distance 1 in f(x).
n Thus, f(x) Î TSP (f(x) has a TSP tour with distance £ B).
Hard problems
17
IRIS H.-R. JIANG
HC £P TSP: Step 2 (cont’d)
¨ G has a HC iff the reduced instance has a TSP with distance £
B.
¤ f(x) Î TSP Þ x Î HC.
n Suppose there is a TSP tour with distance £ n = B. Let it be
<v1, v2, …, vn, v1>.
n Since distance of the tour £ n and there are n edges in the
TSP tour, the tour contains only edges in E.
n Thus, <v1, v2, …, vn, v1> is a Hamiltonian cycle (x Î HC).
Hard problems
18
IRIS H.-R. JIANG
NP-complete
problems
intractable
tractable
??
NP-Completeness
¨ Definition: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for every L' Î NP.
¨ NP-hard: If L satisfies property 2, but not necessarily property
1, we say that L is NP-hard.
¨ Suppose L Î NPC. P=NP?
¤ If L Î P, then there exists a polynomial-time algorithm for every
L' Î NP (i.e., P = NP).
¤ If L Ï P, then there exists no polynomial-time algorithm for any
L' Î NPC (i.e., P ¹ NP).
Hard problems
19
IRIS H.-R. JIANG
Proving NP-Completeness
¨ Theorem: A decision problem L (a language L Í {0, 1}*) is NP-
complete (NPC) if
1. L Î NP, and
2. L' £P L for an L' Î NPC.
¨ Five steps for proving that L is NP-complete:
1. Prove L Î NP.
2. Select a known NP-complete problem L'.
3. Construct a reduction f transforming every instance of L' to an
instance of L.
4. Prove that f is a polynomial-time transformation.
5. Prove that x Î L' iff f(x) Î L for all x Î {0, 1}*.
Hard problems
20
A known
NP-complete
problem L’
A problem L
to be proved
NP-complete
reduce
f