Artificial Intelligence Problem solving by searching CSC 361 Prof. Mohamed Batouche Computer Science Department CCIS – King Saud University Riyadh, Saudi.

Slides:



Advertisements
Similar presentations
Cooperating Intelligent Systems
Advertisements

Problem Solving Well-formed predicate calculus expressions provide a means of describing objects and relations in a problem domain and inference rule.
Formal Description of a Problem
CSC 423 ARTIFICIAL INTELLIGENCE
Feng Zhiyong Tianjin University Fall  datatype PROBLEM ◦ components: INITIAL-STATE, OPERATORS, GOAL- TEST, PATH-COST-FUNCTION  Measuring problem-solving.
SEARCH ALGORITHMS David Kauchak CS30 – Spring 2015.
SEARCH APPLICATIONS David Kauchak CS30 – Spring 2015.
A RTIFICIAL I NTELLIGENCE Problem-Solving Solving problems by searching.
State Spaces Introduction to Artificial Intelligence Dr. Robin Burke.
1 Let’s begin with a story. 2 l Alan Turing, "Computing Machinery and Intelligence", Mind, Volume LIX, Number 236, l Because the paper is now in.
Artificial Intelligence Problem solving by searching CSC 361
CSC-470: ARTIFICIAL INTELLIGENCE
State-Space Searches. State spaces A state space consists of –A (possibly infinite) set of states The start state represents the initial problem Each.
Artificial Intelligence
Now would be a good time to kill your cell phone, and disconnect from the internet. For next time, print Heuristic Search.ppt slides.
Toy Problem: Missionaries and Cannibals
Artificial Intelligence Problem solving by searching CSC 361
Problem solving by Searching Problem Formulation.
Intelligent agents Intelligent agents are supposed to act in such a way that the environment goes through a sequence of states that maximizes the performance.
Introduction to Artificial Intelligence Problem Solving Ruth Bergman Fall 2002.
Artificial Intelligence Problem solving by searching CSC 361 Prof. Mohamed Batouche Computer Science Department CCIS – King Saud University Riyadh, Saudi.
Intelligent agents Intelligent agents are supposed to act in such a way that the environment goes through a sequence of states that maximizes the performance.
Dr Eleni Mangina – COURSE: LOGIC PROGRAMMING (during a joint degree with Fudan University in Software Engineering) DEPT. OF COMPUTER SCIENCE UCD Problem.
Artificial Intelligence Problem solving by searching CSC 361
ITCS 3153 Artificial Intelligence Lecture 4 Uninformed Searches (cont) Lecture 4 Uninformed Searches (cont)
Midterm II Solution Prof. Mohamed Batouche Department of Computer Science CCIS – King Saud University Saudi Arabia.
Representation  A farmer wants to move himself, a hunrgry silver fox, a hungry, fat goose, and a sack of tasty grain across a river. Unfortunately, his.
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.
CS344: Introduction to Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 13– Search.
start 3 missionaries and 3 cannibals Cannibal & Cannibal Missionary & Missionary Cannibal & Missionary Which one we should move first You lose True.
Solving Problems by Searching
State-Space Searches.
Artificial Intelligence Problem solving by searching CSC 361

1 State Space of a Problem Lecture 03 ITS033 – Programming & Algorithms Asst. Prof.
Formal Description of a Problem In AI, we will formally define a problem as –a space of all possible configurations where each configuration is called.
Problem solving.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Knowledge and search, page 1 CSI 4106, Winter 2005 Knowledge and search Points Properties of knowledge  Completeness  Objectivity  Certainty  Formalizability.
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.
Problem solving by search Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
PROBLEM SOLVING – BASIC SEARCH METHODS 12/8/2015Dr. Sunil Kumar 1.
Problem Solving Agents
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Introduction to State Space Search
1/16 Problem solving by Searching Problem Formulation.
Search as a problem solving technique. Consider an AI program that is capable of formulating a desired goal based on the analysis of the current world.
G5AIAI Introduction to AI
Lecture 2: Problem Solving using State Space Representation CS 271: Fall, 2008.
1 How do you define AI? l You were supposed to write a paper for today? nAt your tables spend five minutes talking about what you wrote. nIdentify some.
Knowledge Representation
How do you define AI? You were supposed to write a paper for today?
Uninformed (also called blind) search algorithms)
Problem solving by Searching
David Kauchak CS30 – Spring 2016
Some problems Cse-402 K3r20,k3r23.
Problem Solving as Search
Artificial Intelligence Problem solving by searching CSC 361
4. Computational Problem Solving
Some problems Cse-402 K3r20,k3r23.
Problem Solving by Searching Search Methods :
Knowledge Representation
Artificial Intelligence
State-Space Searches.
ARTIFICIAL INTELLIGENCE
State-Space Searches.
David Kauchak CS51A – Spring 2019
State-Space Searches.
Problem Solving by Searching Search Methods :
Solving Problems by Searching
Presentation transcript:

Artificial Intelligence Problem solving by searching CSC 361 Prof. Mohamed Batouche Computer Science Department CCIS – King Saud University Riyadh, Saudi Arabia

2 Problem Solving by Searching Why search ?  Early works of AI was mainly towards proving theorems solving puzzles playing games All AI is search! Not totally true (obviously) but more true than you might think. All life is problem solving !! Finding a good/best solution to a problem amongst many possible solutions.

3 Classic AI Search Problems Classic AI search problems Map searching (navigation)

4 Classic AI Search Problems 3*3*3 Rubik’s Cube

5 Classic AI Search Problems Classic AI search problems 8-Puzzle

6 Classic AI Search Problems Classic AI search problems N-Queens:

7 Classic AI Search Problems 5-Queens:

8 Classic AI Search Problems 5-Queens:

9 Classic AI Search Problems 5-Queens:

10 Classic AI Search Problems 5-Queens:

11 Classic AI Search Problems 5-Queens:

12 Classic AI Search Problems 5-Queens: Solution !! No Queen is under Attack

13 Missionaries and cannibals Three missionaries and three cannibals are on the left bank of a river. There is one canoe which can hold one or two people. Find a way to get everyone to the right bank, without ever leaving a group of missionaries in one place outnumbered by cannibals in that place.

14 Missionaries and Cannibals Initial State

15 Missionaries and Cannibals Goal State

16 The River Problem A farmer wishes to carry a wolf, a duck and corn across a river, from the south to the north shore. The farmer is the proud owner of a small rowing boat called Bounty which he feels is easily up to the job. Unfortunately the boat is only large enough to carry at most the farmer and one other item. Worse again, if left unattended the wolf will eat the duck and the duck will eat the corn. How can the farmer safely transport the wolf, the duck and the corn to the opposite shore? Farmer, Wolf, Duck and Corn boat River Farmer, Wolf, Duck and Corn boatRiver

Problem Solving by Searching Problem Formulation

18 Problem Formulation A Problem Space consists of The current state of the world (initial state) A description of the actions we can take to transform one state of the world into another (operators). A description of the desired state of the world (goal state), this could be implicit or explicit. A solution consists of the goal state, or a path to the goal state.

19 Problem Formulation 8-Puzzle Problem Initial StateOperatorsGoal State Slide blank square left. Slide blank square right. …

20 Problem Formulation 8-Puzzle Problem Representing states: For the 8-puzzle 3 by 3 array 5, 6, 7 8, 4, BLANK 3, 1, 2 A vector of length nine 5,6,7,8,4, BLANK,3,1,2 A list of facts Upper_left = 5 Upper_middle = 6 Upper_right = 7 Middle_left =

21 Problem Formulation 8-Puzzle Problem Specifying operators: There are often many ways to specify the operators, some will be much easier to implement Move 1 left Move 1 right Move 1 up Move 1 down Move 2 left Move 2 right Move 2 up Move 2 down Move 3 left Move 3 right Move 3 up Move 3 down Move 4 left … Move Blank left Move Blank right Move Blank up Move Blank down

22 Problem Formulation 8-Puzzle Problem Initial stateGoal state Operators: slide blank up, slide blank down, slide blank left, slide blank right Solution: sb-down, sb-left, sb-up,sb-right, sb-down Path cost: 5 steps to reach the goal

Problem Solving by Searching A toy problem: Missionaries and Cannibals

24 Missionaries and cannibals Three missionaries and three cannibals are on the left bank of a river. There is one canoe which can hold one or two people. Find a way to get everyone to the right bank, without ever leaving a group of missionaries in one place outnumbered by cannibals in that place.

25 Missionaries and cannibals States: three numbers (i,j,k) representing the number of missionaries, cannibals, and canoes on the left bank of the river. Initial state: (3, 3, 1) Operators: take one missionary, one cannibal, two missionaries, two cannibals, one missionary and one cannibal across the river in a given direction (I.e. ten operators). Goal Test: reached state (0, 0, 0) Path Cost: Number of crossings.

26 Missionaries and Cannibals (3,3,1): Initial State

27 Missionaries and Cannibals A missionary and cannibal cross

28 Missionaries and Cannibals (2,2,0)

29 Missionaries and Cannibals One missionary returns

30 Missionaries and Cannibals (3,2,1)

31 Missionaries and Cannibals Two cannibals cross

32 Missionaries and Cannibals (3,0,0)

33 Missionaries and Cannibals A cannibal returns

34 Missionaries and Cannibals (3,1,1)

35 Missionaries and Cannibals Two missionaries cross

36 Missionaries and Cannibals (1,1,0)

37 Missionaries and Cannibals A missionary and cannibal return

38 Missionaries and Cannibals (2,2,1)

39 Missionaries and Cannibals Two Missionaries cross

40 Missionaries and Cannibals (0,2,0)

41 Missionaries and Cannibals A cannibal returns

42 Missionaries and Cannibals (0,3,1)

43 Missionaries and Cannibals Two cannibals cross

44 Missionaries and Cannibals (0,1,0)

45 Missionaries and Cannibals A cannibal returns

46 Missionaries and Cannibals (0,2,1)

47 Missionaries and Cannibals The last two cannibals cross

48 Missionaries and Cannibals (0,0,0) : Goal State

49 Missionaries and Cannibals Solution = the sequence of actions within the path : [ (3,3,1)→ (2,2,0)→(3,2,1) →(3,0,0) →(3,1,1) →(1,1,0) →(2,2,1) →(0,2,0) →(0,3,1) →(0,1,0) → (0,2,1) →(0,0,0)]; Cost = 11 crossings

Problem Solving by Searching The River Problem: Farmer, Wolf, Duck and Corn

51 The River Problem Let’s consider the River Problem: A farmer wishes to carry a wolf, a duck and corn across a river, from the south to the north shore. The farmer is the proud owner of a small rowing boat called Bounty which he feels is easily up to the job. Unfortunately the boat is only large enough to carry at most the farmer and one other item. Worse again, if left unattended the wolf will eat the duck and the duck will eat the corn. How can the farmer safely transport the wolf, the duck and the corn to the opposite shore? Farmer, Wolf, Duck and Corn boat River

52 The River Problem The River Problem: F=Farmer W=Wolf D=Duck C=Corn /=River How can the farmer safely transport the wolf, the duck and the corn to the opposite shore? FWCD/- -/FWCD

53 The River Problem Problem formulation: State representation: location of farmer and items in both sides of river [ items in South shore / items in North shore ] : (FWDC/-, FD/WC, C/FWD …) Initial State: farmer, wolf, duck and corn in the south shore FWDC/- Goal State: farmer, duck and corn in the north shore -/FWDC Operators: the farmer takes in the boat at most one item from one side to the other side (F-Takes-W, F-Takes-D, F-Takes-C, F-Takes-Self [himself only]) Path cost: the number of crossings

54 The River Problem Problem solution: (path Cost = 7) While there are other possibilities here is one 7 step solution to the river problem FWDC FWDC F-Takes-D Initial State F W D C F-Takes-D WC/FD Goal State F-Takes-S F W D C FD/WC F-Takes-C FW D C D/FWC F W DC F-Takes-D FDC/W FWD C F-Takes-W C/FWD F-Takes-S FW D C FWC/D

55 Search: process of constructing sequences of actions that achieve a goal given a problem. It is assumed that the environment is observable, deterministic, static and completely known. Goal formulation is the first step in solving problems by searching. It facilitates problem formulation. Formulating a problem requires specifying five components: State representation, Initial state, Goal state, Operators (actions), and Path cost function. Summary