4. Computational Problem Solving

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

MATH 224 – Discrete Mathematics
Types of Algorithms.
The Efficiency of Algorithms
CSC 423 ARTIFICIAL INTELLIGENCE
 The amount of time it takes a computer to solve a particular problem depends on:  The hardware capabilities of the computer  The efficiency of the.
8 Algorithms Foundations of Computer Science ã Cengage Learning.
HST 952 Computing for Biomedical Scientists Lecture 9.
Scott Grissom, copyright 2004 Chapter 5 Slide 1 Analysis of Algorithms (Ch 5) Chapter 5 focuses on: algorithm analysis searching algorithms sorting algorithms.
1 Algorithms and Analysis CS 2308 Foundations of CS II.
Joseph L. Lindo Algorithms and Data Structures Sir Joseph Lindo University of the Cordilleras.
Algorithm Analysis Dr. Bernard Chen Ph.D. University of Central Arkansas.
BIT Presentation 4.  An algorithm is a method for solving a class of problems.  While computer scientists think a lot about algorithms, the term.
1 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
(C) 2010 Pearson Education, Inc. All rights reserved. Java How to Program, 8/e.
1 Ethics of Computing MONT 113G, Spring 2012 Session 13 Limits of Computer Science.
Module 1- Getting Started Tell me what to do Using sets of instructions…
1 Section 2.1 Algorithms. 2 Algorithm A finite set of precise instructions for performing a computation or for solving a problem.
Erdal Kose CC30.10 These slides are based of Prof. N. Yanofsky Lecture notes.
1 Algorithms  Algorithms are simply a list of steps required to solve some particular problem  They are designed as abstractions of processes carried.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Searching Topics Sequential Search Binary Search.
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
Design and Analysis of Algorithms Faculty Name : Ruhi Fatima Course Description This course provides techniques to prove.
Section 1: Problem solving AQA Computing A2 © Nelson Thornes 2009 Examples of problems with different time complexities Section 1.2: Comparing algorithms.
The Need for Algorithms
Decision Trees DEFINITION: DECISION TREE A decision tree is a tree in which the internal nodes represent actions, the arcs represent outcomes of an action,
Shortest Path Problems
BackTracking CS255.
COMP108 Algorithmic Foundations Polynomial & Exponential Algorithms
IGCSE 6 Cambridge Effectiveness of algorithms Computer Science
Computer Science Programming Chapter 1, Sections
Introduction to Algorithms
Unsolvable Problems December 4, 2017.
Algorithm Analysis CSE 2011 Winter September 2018.
Professor, Computer Science and Engineering Department
Enough Mathematical Appetizers!
Red-Black Trees Motivations
Types of Algorithms.
Binary Search Back in the days when phone numbers weren’t stored in cell phones, you might have actually had to look them up in a phonebook. How did you.
Last Class We Covered Data representation Binary numbers ASCII values
Higher-Order Procedures
Computational Thinking
Route Optimization Problems and Google Maps
Types of Algorithms.
Chapter Two: Finite Automata
Theory of Computation Turing Machines.
Applied Discrete Mathematics Week 6: Computation
Algorithm Discovery and Design
Chapter 3 Brute Force Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Artificial Intelligence Problem solving by searching CSC 361
Applied Combinatorics, 4th Ed. Alan Tucker
Recurrences (Method 4) Alexandra Stefan.
3. Brute Force Selection sort Brute-Force string matching
Introduction to Data Structures
Pruning 24-Feb-19.
Algorithms Step-by-step instructions that tell a computing agent how to solve some problem using only finite resources Resources Memory CPU cycles Time/Space.
Algorithms Step-by-step instructions that tell a computing agent how to solve some problem using only finite resources Resources Memory CPU cycles Time/Space.
Lecture 6 Architecture Algorithm Defin ition. Algorithm 1stDefinition: Sequence of steps that can be taken to solve a problem 2ndDefinition: The step.
3. Brute Force Selection sort Brute-Force string matching
Types of Algorithms.
Artificial Intelligence CIS 342
Basic Concepts of Algorithm
Lecture One: Automata Theory Amjad Ali
U3L2 The Need For Algorithms
Analysis of Algorithms
3. Brute Force Selection sort Brute-Force string matching
Presentation transcript:

4. Computational Problem Solving 2016.2.15 Yusung Kim yskim525@gmail.com

Motivation The first electronic computers were referred to as “Electronic Brains”. Computer = Powerful + Stupid Execute a series of instructions very quickly (billions of operations per second) No more intelligence than what it is instructed to do (nothing like insight or understanding) How to make computers useful ?

How does a computer work ? Computer is driven by code instructions Instructions simple such as “add two numbers” The computer runs a long series of instructions code computer Instruction1 (1+2) Instruction2 2 < 10 ? Instruction3 … instruction4 Instruction5 …

How to get an useful code ? Human thinks of a useful feature Break a problem down Think up a good algorithm (steps) Write codes for the computer Code is like lego bricks Individual pieces are very simple Eventually build up great combinations

Computational Problem Solving Computational problem solving lets computers be able to solve a problem. To perform computational problem solving, we need to do; problem analysis that identifies the main problem a representation that captures all the relevant aspects of the problem an algorithm that is a set of step-by-step operations to solve the problem

Problem Analysis Identifying the main problem and establishing the causes and effects related to that problem. What is the problem? Why does the problem exist? Who is causing the problem, and who is affected by it? When did the problem first occur or when did it become significant?

Problem Analysis Tools fishbone diagram problem tree

Abstraction A representation that leaves out detail of what is being represented is a form of abstraction. Abstraction is prevalent in the everyday world. For example, maps are abstract representations.

Below is the original 1908 map of the London Subway

Below is a more abstract, but topologically correct Below is a more abstract, but topologically correct. It shows the bends and curves of each track. This map contains too much information for its purpose—that is, to find out where each subway line leads, and where the connections are between lines.

This particular abstraction is still in use today.

Decomposition Breaking a complex problem or system into parts that are easier to conceive, understand, program, and maintain.

Algorithm A set of rules for solving a problem in a finite number of steps with given input and output.

Problem Solving Example: Man, Cabbage, Goat, Wolf A man lives on the east side of a river. He wishes to bring a cabbage, a goat, and a wolf to the west side of the river to sell. However, his boat is only big enough to hold himself, and either the cabbage, goat, or wolf. In addition, the man cannot leave the goat alone with the cabbage because the goat will eat the cabbage, and he cannot leave the wolf alone with the goat because the wolf will eat the goat. How to solve this problem?

Abstraction Example What would be an appropriate representation for this problem? Representation should include only the aspects of the problem that are relevant for its solution. Color of the boat? Name of the man? Width of the river? Speed of the boat? The only information relevant for this problem is where each particular item is at each step in the problem solving. Therefore, by the use of abstraction, we define a representation that captures only this needed information.

The relevant, minimal representation is a sequence to indicate where each object currently is, man cabbage goat wolf [east, west, east, west] The first item in the sequence is the location of the man, the second is the location of the cabbage, etc.

to the goal state (all objects on the west side of the river), The actual problem is to determine how the man can row objects across the river, with certain constraints. The computational problem is to find a way to convert the start state of the problem (all is on the east side of the river), man cabbage goat wolf [ E , E , E , E ] to the goal state (all objects on the west side of the river), [ W , W , W , W ] with the constraint that invalid states should never be used.

Decomposition Example A man wants to row a cabbage, a goat, and a wolf across a river. Select a single object (or nothing) Check validation of given constraints Row the selected object a river

Algorithm Example start select an object check validation no (invalid) check validation yes(valid) cross the river check final state no yes end

Examine Algorithm For example, from the start state, there are three possible moves that can be made, only one of which results in a valid state. man cabbage goat wolf [E, E, E, E] START STATE [W, E, W, E] Man rows goat across VALID STATE Cabbage left alone with wolf [W, E, E, W] Man rows wolf across INVALID STATE Cabbage left alone with goat [W, W, E, E] Man rows cabbage across INVALID STATE Goat left alone with wolf

Therefore, we continue searching from the current state. We check if the current state is the goal state. If true, then we solved the problem. Otherwise, keep going. man cabbage goat wolf [E, E, E, E] START STATE [W, E, W, E] CURRENT STATE Man rows goat across Is it goal state [W,W,W,W]? No Therefore, we continue searching from the current state.

There are only two possible options from here, man cabbage goat wolf [W, E, W, E] CURRENT STATE [E, E, E, E] Man rows goat across VALID STATE But, this is same to the START STATE. No progress made! [E, E, W, E] Man rows back alone VALID STATE Goat left alone

This would continue until the goal state is reached, man cabbage goat wolf [E, E, W, E] [W, W, W, W] GOAL STATE As reaching the goal state, we can find a solution of the actual problem. .

The Limits of Computational Problem Solving Once an algorithm for a given problem is developed or found, an important question is “can a solution to the problem be found in a reasonable amount of time?” “But aren’t computers very fast, and getting faster all the time?” Yes, but some problems require an amount of time to compute a solution that is astronomical compared to the capabilities of current computing devices. Let’s see a classic problem in computer science, the Traveling Salesman Problem (TSP).

Problem Solving Example #2. The Traveling Salesman Problem A salesman needs to visit a set of cities. He wants to find the shortest route of travel that visits each city exactly once and returns to the origin city. You may simply try all possible combinations of routes, and find the shortest one. (called “a brute-force approach”) for a given set of cities, how many possible routes are there?

How big the number is as increasing the number of cities? If we consider a route to be a specific sequence of names of cities, then how many permutations of that list are there? New York, Boston, Chicago, San Francisco, Los Angeles, Atlanta Boston, New York, Chicago, San Francisco, Los Angeles, Atlanta Chicago, Boston, New York, San Francisco, Los Angeles, Atlanta …. Mathematically, the number of permutations for n entities is n! (n factorial). How big the number is as increasing the number of cities?

Assume: a computer could compute one million routes per second. For Example; Ten Cities : 10! 3,628, 800 (over three million) Twenty Cities : 20! 2,432,902,008,176,640,000 Fifty Cities : 50! Over 1064 Assume: a computer could compute one million routes per second. For ten cities, it would take 3.6 seconds For twenty cities, it would take 77,000 years For fifty cities, it would take longer than the age of the universe! For problems such as the Traveling Salesman Problem (TSP), a brute-force approach is impractical to use. More clever and more efficient problem-solving methods must be discovered to find either an exact or an approximate solution to the problem.

Backup slides

Problem Solving #3. Searching Searching a given name in a phone book. tens of million names Names are sorted Sequential searching (starting form the first/last page) Worst case ? Average case ? Binary searching (1) Open to middle of book, and look at the name (2) Look at the page (3) if the name is in the page, call him (her) (4) if the name is earlier in book, open to middle of left half of book; go to (2) (5) if the name is later in book, open to middle of right half of book; go to (2)