Problem Solving Logical reasoning or deductive reasoning.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Artificial Intelligence: Knowledge Representation
Problem Solving Well-formed predicate calculus expressions provide a means of describing objects and relations in a problem domain and inference rule.
28 Plenary Ideas for Mathematics By Jean Knapp. 27/04/2015J. Knapp 6/062 Plenary (1) Work in pairs. List 3 things you learnt today. Share them with your.
101.  Computers DO NOT think for themselves. For them to do anything they need to be told what to do.  Simply put computer programming is when you tell.
Chapter 7 Graph Theory 7.1 Modeling with graphs and finding Euler circuits. Learning Objectives: Know how to use graphs as models and how to determine.
Inferences The Reasoning Power of Expert Systems.
Graphs Graphs are the most general data structures we will study in this course. A graph is a more general version of connected nodes than the tree. Both.
Problem Solving and Search in AI Part I Search and Intelligence Search is one of the most powerful approaches to problem solving in AI Search is a universal.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
Dr Eleni Mangina – COURSE: LOGIC PROGRAMMING (during a joint degree with Fudan University in Software Engineering) DEPT. OF COMPUTER SCIENCE UCD Problem.
Programming Fundamentals (750113) Ch1. Problem Solving
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Backtracking.
Problem Solving. What is a Problem? An ambiguous situation not clearly showing how to reach the goal. Given Initial Situation Desired Goal Situation What.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
Programming for Geographical Information Analysis: Advanced Skills Online mini-lecture: Introduction to Networks Dr Andy Evans.
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
1 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
How to revise!. Remember! Different strategies work for different people Learning styles: –visual, –auditory, –kinaesthetic (practical) You need to use.
Top-Down Design and Modular Development
Program Design CMSC 201. Motivation We’ve talked a lot about certain ‘good habits’ we’d like you guys to get in while writing code. There are two main.
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
1 Starter of the day 23 x 27 = x 47 = x 87 = x 55 = x 58 = ???? 54 x 56 = ???? Can you spot the trick for this group of.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Algorithms and their Applications CS2004 ( ) Dr Stephen Swift 1.2 Introduction to Algorithms.
Section 3.1: Proof Strategy Now that we have a fair amount of experience with proofs, we will start to prove more difficult theorems. Our experience so.
Extending the Definition of Exponents © Math As A Second Language All Rights Reserved next #10 Taking the Fear out of Math 2 -8.
BackTracking CS335. N-Queens The object is to place queens on a chess board in such as way as no queen can capture another one in a single move –Recall.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Black-box Testing.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
Graphs. 2 Graph definitions There are two kinds of graphs: directed graphs (sometimes called digraphs) and undirected graphs Birmingham Rugby London Cambridge.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Connected Components Fun with graphs, searching, and queues.
Algorithm: definition An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Understanding Task Analysis
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Explorers need maps: Abstraction, representations and graphs Paul Curzon Queen Mary University of London
Week 12 - Wednesday.  What did we talk about last time?  Matching  Stable marriage  Started Euler paths.
Graphs A ‘Graph’ is a diagram that shows how things are connected together. It makes no attempt to draw actual paths or routes and scale is generally inconsequential.
Alternative Algorithms for Addition and Subtraction If we don’t teach them the standard way, how will they learn to compute?
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board.
Combinatorial Optimization Lecturer Kononov Alexander Veniaminovich.
Search in State Spaces Problem solving as search Search consists of –state space –operators –start state –goal states A Search Tree is an efficient way.
Problem solving Introduction to programming. Do Now You are at a river that you want to cross with all your goods. Your goods consist of a chicken, a.
Text INTERNAL February 11, 2011 Problem Solving. INTERNAL Tech Republic’s railway department wants a solution Tech Republic’s railway department.
G5AIAI Introduction to AI
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
AS Computer Studies Algorithms & Problem Solving 1 & 2.
FLOWCHARTS Part 1.
Çizge Algoritmaları.
The Knight’s Tour Graphs, Algorithms, Abstraction and Decomposition
Computational Thinking
Graphs Chapter 13.
Programming Fundamentals (750113) Ch1. Problem Solving
Computational Thinking for KS3
4. Computational Problem Solving
Haskell Tips You can turn any function that takes two inputs into an infix operator: mod 7 3 is the same as 7 `mod` 3 takeWhile returns all initial.
I believe the reason students have difficulty learning algebra and that most people have trouble doing math word problems is that although children are.
Presentation transcript:

Problem Solving Logical reasoning or deductive reasoning. Using a set of facts to determine whether a new set of facts are true or false. Some problems to consider: There are two jugs. A and B. Jug A has a capacity of three litres. Jug B has a capacity of five litres. There are no markings on the jugs, so it is not possible to tell exactly how much is in a jug just by looking at it, unless it is full or empty. There is a sink with a water tap and a drain. How can exactly 4 litres of water be obtained from the tap using the jugs Step Jug A (3) Jug B (5) 1

Problem Solving Some problems to consider: Step Jug A (3) Jug B (5) 1 2 4 5 6 7 8

Problem Solving Some problems to consider: 2) The police are interrogating five suspects after a bank robbery. Each of them makes two statements, but it turns out only five of these statements are true. Can you work out who committed the crime? What strategy will you use to work it out? Alan said: It wasn’t Ben. It was Carl. Ben said: It wasn’t Alan. It was Dave. Carl said: It wasn’t Dave. It wasn’t Ben, either. Dave said: It wasn’t Eddie. It was Alan. Eddie said: It wasn’t Carl. It was Derek.

Problem Solving Some problems to consider: 3) You are in a room with 2 doors leading out. Behind 1 door is a coffer overflowing with jewels and gold, along with an exit. Behind the other door is an enormous, hungry lion that will pounce on anyone opening the door. You do not know which door leads to the treasure and exit, and which door leads to the lion. In the room you are in are 2 individuals. The first is a knight, who always tells the truth, and a knave, who always lies. Both of these individuals know what is behind each door. You do not know which individual is the knight, or which one is the knave. You may ask one of the individuals exactly 1 question. What should you ask in order to be certain that you will open the door with the coffer behind it, instead of the hungry lion?

2 Stages of Problem Solving Defining the problem. A well defined problem has four components A clearly defined initial condition given. A clearly defined goal. A clearly defined set of resources and constraints. Ownership. For example: You are at a river that you want to cross with all your goods. Your goods consist of a chicken, a bag of grain and your dog, Rover. You have to cross the river in your rowing boat but can only take one passenger at a time – the chicken, the dog or the bag of grain. You can’t leave the chicken alone with the grain as the chicken will eat the grain. You can’t leave your dog alone with the chicken as Rover will eat the chicken. However you know that Rover does not eat grain. How do you get everything across the river intact 2

2 Stages of Problem Solving CAN YOU COME UP WITH A SOLUTION? So lets break this problem down into its components Initial Situation You, the chicken, the bag of grain and the dog are on one bank of a river with access to a rowing boat. Resources The rowing boat and your knowledge and problem solving skill, Constraints You can only take one passenger, you must not leave Rover with the chicken or the chicken with the grain. Goal You, the chicken, the bag of grain and the dog on the opposite bank of river. Ownership You will be involved in planning the solution and carrying it out. CAN YOU COME UP WITH A SOLUTION? 2

2 Stages of Problem Solving Puzzle: Lateral Thinking. Some problems don’t give you all the facts and you have to Use lateral thinking to establish some more. Puzzle: Six glasses are arranged in a line. The first three are filled with water, the second three are empty. You are allowed to move only a single glass. In one move can you achieve an ordering of the glasses which alternates full and empty glasses along the line? What constraint or boundaries did you assume? A man lives on the 18th floor of a tower block. Every weekday morning he takes the lift to the ground floor and walks to work. Every weekday evening, he walks from work, takes the lift to the 12th floor and then takes the stairs to the 18th floor. If it was raining in the morning, he takes the lift straight to the 18th floor in the evening. Why? In all problems challenge your assumptions! 2

Problem Solving Strategies for problem solving Exhaustive search You are to fill a square with 9 numbers. Each Row, column and diagonal needs to add up to the same value. This is a specific instance (0-9 & 3X3) of a general problem (N-N & NXN) How would you solve this problem?

Problem Solving Strategies for problem solving Exhaustive search One method is to use an EXHAUSTIVE SEARCH = which simply means trying ever possible combination until you get it. This would work out as 9*8*7*6*5*4*3*2*1 which = 362,880 possible ways of filling the square or 9! Size of the problem – 5X5 = 25! = 1.55 * 1025 possible ways of filling the square.

Problem Solving Strategies for problem solving Exhaustive search Needs a better algorithm What if we knew that the middle number has to be 5 and each 3 numbers had to add up to 15 – would be easier.

Problem Solving Strategies for problem solving 2) Divide and conquer or binary search Ask a friend to think of a number between 1 and 1000. You have a guess and your friend tells you whether it is correct, too low or too high. What is the maximum number of guesses you will need with this form of search method? How many guess between 1 and 2N How many guesses would this take using an exhaustive search?

This is where developing good algorithms come in. Problem Solving Strategies for problem solving 3) A flash of insight. You have a bag of 8 coins which all look identical, but one of them is counterfeit and weighs less than a genuine coin. You have a two-pan balance, but no weights. What is the maximum number of weighing's needed to identify the fake coin? The trick is to think of a method that reduces the need of using an exhaustive search. This is where developing good algorithms come in.

Abstraction The process of reducing a problem to their essential features. Finding similarities or common aspects about a problem and ignoring the differences. View from a high level – ignoring the detail. We use abstractions every day

Abstraction Two types of abstraction Representational Abstraction Generalisation/Categorisation

Abstraction – Representational Process of removing unnecessary details until it is possible to represent the problem in a way that can be solved. Looking more at the big picture. See previous slide with the London Underground Useful for someone travelling around London. Is it useful for an engineer wanting to build a new Line in the underground? Sat Nav Example: Identify point A and point B in someway Identify the connecting paths between A and B Calculate the shortest path between A and B. Remove irrelevant information such as rivers, railways, landmarks etc.

Abstraction –Generalisation / Catergorisation Placing aspects of problem into broader categories to arrive at a Hierarchical representation Used in Object orientated programming. Vehicles Car Bus Lorry Van

Information Hiding Ties in with abstraction – The removing or all irrelevant details from a problem. For example – the Bridge problem. 200 years ago in the old Prussian city of Koingsberg. It had seven bridges and the inhabitants likes to stroll around the city on a Sunday afternoon, making sure to cross every bridge at least once. Nobody could figure out how to cross each bridge once and once only. Leonhard Eular used Information hiding to solve this problem.

Information Hiding The map of the city with the bridges.

Information Hiding Remove all irrelevant details from the map to come up with an abstraction

Information Hiding Create a graph with vertices and edges to represent the bridges and islands Euler concluded that each node needs to have an even number of connections to enter and leave in order for each bridge to be crossed once – therefore the above is impossible. Set a foundation to solve similar problems. North Bank West Island East Island South Bank

Abstraction – Procedural Abstraction The concept that all solutions can be broken down into a series of sub problems. How programs written in code work. Design stage – sufficient to state what each procedure does not how it does it. Values are hidden from each procedure. Amendments can be isolated and changes made easily without affecting the whole solution. Procedure for Drawing Street Hides detail from Depends on Procedure for drawing house Hides detail from Depends on Procedures for drawing shapes.

Abstraction – Functional Abstraction Similar to Procedural Abstraction The use of common functions to solve problems – generic across many problems. Also can be the actual application of the procedures mentioned last slide - in a coding language. The methods and data of the function are hidden from the user. e.g. Console.WriteLine() Console.ReadLine()

Abstraction – Data Abstraction Process of organising and structuring data in a way that is useful to the programmer but how it is actually represented in the computer is hidden. Data types such as integers and strings have some abstraction to them. Higher level data abstractions such as queues, stacks, linked lists, trees etc. The hiding away of their representation allows you to build new data types fairly easy – such as stacks from arrays – or records from a number of data types. A separation of the actual implementation from the interface or use.

Abstraction – Problem Abstraction Removing details until the problem is represented in a way that is possible to solve. How many moves would it take to swap the knights around.

1 2 3 4 5 6 7 8 9 Abstraction – Problem Abstraction Number the board How many moves would it take to swap the knights around.

Abstraction – Problem Abstraction Create a graph joining up the numbers that are connected. 5 Has been removed. 2 1 3 How many moves would it take to swap the knights around. 4 6 7 9 8

Abstraction – Problem Abstraction Create a graph joining up the numbers that are connected. 5 Has been removed. 1 6 8 Now it is a bit easier to visualise a solution to this problem. 7 3 2 4 9

Decomposition / Composition Breaking down large complex tasks or processes down into smaller more manageable tasks. Abstraction techniques are applied in this process. Procedural Composition – Process of creating a working system from the abstraction: Writing all the procedures and linking them together to create compound procedures Creating data structures and combining them to form compound structures.

Decomposition / Composition A Sat Nav System Sat Nav System Journey Start Point End Point Travel Input travel data Input travel updates Road Network National Roads International Roads Calculate Route

Automation Process of creating computer models of real-life situations and putting them into action. Creates elegant solutions to difficult problems Understand the problem Begin able to create suitable algorithms Building up the algorithms into program code Using appropriate data in order to solve the problem. Example – Traffic light system A specification needs to consider: Location of all traffic lights The number of roads that meet at each set of traffic lights How many lanes of traffic are at each set of lights How much traffic there is on each of the lanes What time of day it is. Do they control a pedestrian crossing as well. Reviews of the system in play may required the rewriting of algorithms