200 likes | 391 Views
Hard Problems and Limits Of Computers. Erdal Kose CC30.10. These slides are based of Prof. N. Yanofsky Lecture notes. Objectives. What Computers Can do Some Easy Problems Adding & Multiply Numbers Searching Sorting Euler Circuit (Konigsberg bridges) How Hard Can a Problem be?
E N D
Hard Problems and Limits Of Computers Erdal Kose CC30.10 These slides are based of Prof. N. Yanofsky Lecture notes
Objectives • What Computers Can do • Some Easy Problems • Adding & Multiply Numbers • Searching • Sorting • Euler Circuit (Konigsberg bridges) • How Hard Can a Problem be? • NP-Problems • Reduction Of Problems • What A Computer Cannot do (Halting Problem)
What Can Computers do • Computer can; • add , multiply numbers, • sort any given input, • search through millions of records for a specific one.
Some Easy Problems • Adding and Multiplying numbers • The computerense term for a standard procedure or exact sequence of instructions is Algorithm (Steps for solving a problem) • Searching: imagine you are looking for a cabinet full of files where each file contains information about musical bands. The only way to find the desired file is to examine them all, one at a time. Such a quest might be termed a brute-force search.
Cont.. • Sorting: there are many different algorithms for perform sorting. The simplest one is • selection sort: • Search through all the elements and find the minimum element • Swap that minimum element with the first element in the list • Search the rest of the list until you find its minimum • Swap that element with the second element in the list • Continue this procedure until all the elements are in their correct position
Euler Circuit • The city of Königsberg in Prussia (now Kaliningrad, Russia) was set on both sides of the Pregel River, and included two large islands which were connected to each other and the mainland by seven bridges. • The problem was to find a walk through the city that would cross each bridge once and only once. The islands could not be reached by any route other than the bridges, and every bridge must have been crossed completely every time (one could not walk half way onto the bridge and then turn around and later cross the other half from the other side). • Site: www.wikipedia.org www.wikipedia.org
Cont.. www.wikipedia.org
Cont.. • All the problems presented so far can be solved with algorithms that demand n, n2 , log(n) operations. Such problems are called polynomial problems. They can be performed with a polynomial amount of operations. The collection all polynomial problems is denoted as P • All polynomial problems can be solved ona modern computer in a feasible amount of operations. Such problems take a feasible amount of time to solve.
Hard Problems • In order to show how hard a problem is, let introduce some problems which are easy to describe. • The Traveling Salesman Problem. • Hamiltonian Cycle Problem • Set Partition Problem • Subset Problem • Satisfiability Problem
Playing Chess • A board configuration must be represented in bits. Nest the computer must use an algorithm to decide on a move. • The algorithm use an evaluation function. Based on the evaluation function a computer will make a move. • Checking the all possible moves for a computer is generally infeasible. It will take a long time, such as one hundred years to make a move.
Cont.. • Such Problem, where we are given an input and we are asked to find the shortest or longest or the best solutions called an Optimization Problem • Many problems that computers can solve are optimization problems. • All these problems can also come in anther form called decision problem • A decision problems is one in which the computer is only required to give a “yes” or “No” answer
Cont.. • The class of all decision problem that demand 2n or n! Operations to solve is called NP • All problem in NP will be called an “NP problem” • Since P is the class of problems that can be solved in a polynomial amount of operations, polynomials grow slower than exponential or factorial, we have set P is a subset of NP. • That’s mean every “easy” problem is an element of the class of “hard” or easy problems, or P<=NP.
Universality Problem • What does make a computer more powerful than another? • Any computer using simple instructions could simulate any other computer. That means; all the computers have the same power, some might be faster than the other, but all of them are designed in the same way. This fact is known as Universality Principle. • Dell, HP, Sony, IBM, Macintosh: they are all same. Depending to their hardware, some might be fast, but all of them are designed in the same way.
How hard can a problem be? • There are algorithms requiring work proportional to n, n, n2 ,n3 , and so on. This algorithms are know as polynomial time algorithms • There are algorithms requiring work proportional to exponential time. • Problems that required polynomial time (such as n, n2 ,n3 ) to be solved are know as easy problem. • Examples: sorting problems, searching problems.
NP-Complete Problems (infeasible Problems) • There are much more difficult computations, may of which are important to business, science, and engineering. For example finding the cheapest set of plane tickets for a touring n cities. This kind of problems do not have a “practical” algorithmic solution. Such problems are know as NP-Problems. • NP-Problems are hard Problems.
Reduction of Problems • Imagine we have a problem B and a computer that can solve problem B. That means we have a machine that can input an instance of the problem B and will output either a “YES” or “No” depending on whether or not the instance has a solution. • Now imagine that we have a problem A. If there is way of transforming an instance of problem A in to an instance of problem B, we can create a machine that decide A by connecting the transformer to the B decider. • When We have such a relationship between problem A and B, we say we have a reduction of problem A to problem B or problem A reduces to problem B
Unsolvable problems • There are some problems computer cannot solve at all. It is not that algorithm takes too long, there are NO algorithm, no solution, period!!!! • For example it is impossible for a computer to determine if a program has a bug (logical mistake, such as an infinite loop) in it. • The problem of wringing a program to get a program as input and to check if that program has an infinite loop in it is know as loop checker . It also known as HALTING PROBLEM.