Mahgul Gulzai Moomal Umer Rabail Hafeez

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

Ch 4. Heuristic Search 4.0 Introduction(Heuristic)
1 CS 385 Fall 2006 Chapter 4 Heuristic Search. 2 Heuristics eurisko ("I discover" in Greek) "the study of the methods and rules of discovery and invention."
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Artificial Intelligence Chapter 9 Heuristic Search Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Using Heuristics in Games At that time two opposing concepts of the game called forth commentary and discussion. The foremost players distinguished two.
Artificial Intelligence Adversarial search Fall 2008 professor: Luigi Ceccaroni.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
Game Playing (Tic-Tac-Toe), ANDOR graph By Chinmaya, Hanoosh,Rajkumar.
Artificial Intelligence
Search in AI.
Lecture 12 Last time: CSPs, backtracking, forward checking Today: Game Playing.
MINIMAX SEARCH AND ALPHA- BETA PRUNING: PLAYER 1 VS. PLAYER 2.
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
State Space 4 Chapter 4 Adversarial Games. Two Flavors Games of Perfect Information ◦Each player knows everything that can be known ◦Chess, Othello Games.
This time: Outline Game playing The minimax algorithm
1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.
1 Game Playing Chapter 6 Additional references for the slides: Luger’s AI book (2005). Robert Wilensky’s CS188 slides:
Game Playing CSC361 AI CSC361: Game Playing.
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
Find a Path s A D B E C F G Heuristically Informed Methods  Which node do I expand next?  What information can I use to guide this.
Problem Solving and Search in AI Heuristic Search
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Monotonicity Admissible Search: “That finds the shortest path to the Goal” Monotonicity: local admissibility is called MONOTONICITY This property ensures.
1 Tree Searching Strategies. 2 The procedure of solving many problems may be represented by trees. Therefore the solving of these problems becomes a tree.
HEURISTIC SEARCH. Luger: Artificial Intelligence, 5 th edition. © Pearson Education Limited, 2005 Portion of the state space for tic-tac-toe.
1 Heuristic Search 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games.
1 Midterm Review cmsc421 Fall Outline Review the material covered by the midterm Questions?
Game Playing: Adversarial Search Chapter 6. Why study games Fun Clear criteria for success Interesting, hard problems which require minimal “initial structure”
State-Space Searches.
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
KU NLP Heuristic Search Heuristic Search and Expert Systems (1) q An interesting approach to implementing heuristics is the use of confidence.
Game Playing.
October 3, 2012Introduction to Artificial Intelligence Lecture 9: Two-Player Games 1 Iterative Deepening A* Algorithm A* has memory demands that increase.
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
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.
George F Luger ARTIFICIAL INTELLIGENCE 5th edition Structures and Strategies for Complex Problem Solving HEURISTIC SEARCH Luger: Artificial Intelligence,
George F Luger ARTIFICIAL INTELLIGENCE 6th edition Structures and Strategies for Complex Problem Solving HEURISTIC SEARCH Luger: Artificial Intelligence,
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
CS 415 – A.I. Slide Set 6. Chapter 4 – Heuristic Search Heuristic – the study of the methods and rules of discovery and invention State Space Heuristics.
Game Playing. Introduction One of the earliest areas in artificial intelligence is game playing. Two-person zero-sum game. Games for which the state space.
For Monday Read chapter 4, section 1 No homework..
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Ch4 Heuristic Search Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011.
Knowledge Search CPTR 314.
George F Luger ARTIFICIAL INTELLIGENCE 5th edition Structures and Strategies for Complex Problem Solving HEURISTIC SEARCH Luger: Artificial Intelligence,
HEURISTIC SEARCH 4 4.0Introduction 4.1An Algorithm for Heuristic Search 4.2Admissibility, Monotonicity, and Informedness 4.3Using Heuristics in Games 4.4Complexity.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
3.5 Informed (Heuristic) Searches This section show how an informed search strategy can find solution more efficiently than uninformed strategy. Best-first.
1 HEURISTIC SEARCH ( INFORMED SEARCH). 2  From Greek heuriskein, “to find”.  Of or relating to a usually speculative formulation serving as a guide.
1 HEURISTIC SEARCH ( INFOREMD SEARCH). 2  From Greek heuriskein, “to find”.  Of or relating to a usually speculative formulation serving as a guide.
Adversarial Search 2 (Game Playing)
Adversarial Search and Game Playing Russell and Norvig: Chapter 6 Slides adapted from: robotics.stanford.edu/~latombe/cs121/2004/home.htm Prof: Dekang.
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
For Monday Read chapter 4 exercise 1 No homework.
Adversarial Search and Game-Playing
Last time: search strategies
AI Classnotes #5, John Shieh, 2012
Iterative Deepening A*
Heuristic Search A heuristic is a rule for choosing a branch in a state space search that will most likely lead to a problem solution Heuristics are used.
State Space 4 Chapter 4 Adversarial Games.
Chapter 6 : Game Search 게임 탐색 (Adversarial Search)
NIM - a two person game n objects are in one pile
Introduction to Artificial Intelligence Lecture 9: Two-Player Games I
Unit II Game Playing.
Presentation transcript:

Mahgul Gulzai Moomal Umer Rabail Hafeez Heuristic Search Mahgul Gulzai Moomal Umer Rabail Hafeez

Outline Introduction Definition of heuristic search Algorithms of heuristic search Best first search Hill climbing strategy Implementing heuristic evaluation functions Admissibility, Monotonicity and Informedness Using heuristic in games Artificial Intelligence www.csc.csudh.edu

Introduction Human generally consider number of alternative strategies on their way to solving a problem . To obtain the best possible strategy, humans use search. For example : A chess player consider number of possible moves, A Doctor examine several possible diagnoses . Human Problem solving seems to be based on judgmental rules that guide our search to those portion of state Space that seems some how promising. These rules are known as “Heuristics” Artificial Intelligence www.csc.csudh.edu

Definition George Polya defines Heuristics as, “The study of methods and rules of discovery and invention”. A heuristic is a method that might not always find the best solution . but is guaranteed to find a good solution in reasonable time. By sacrificing completeness it increases efficiency. Useful in solving tough problems which could not be solved any other way. solutions take an infinite time or very long time to compute. Artificial Intelligence www.csc.csudh.edu

AI and Heuristic Search Heuristic Search is used in AI in two situations: When a problem doesn’t have an exact solution. There is an exact solution but the computational cost of finding it exceeds the limit. Artificial Intelligence www.csc.csudh.edu

Example- Tic Tac Toe Consider the game of tic-tac-toe. Even if we use symmetry to reduce the search space of redundant moves, the number of possible paths through the search space is something like 12 x 7! = 60480. That is a measure of the amount of work that would have to be done by a brute-force search. Artificial Intelligence www.csc.csudh.edu

First three levels of the tic-tac-toe state space reduced by symmetry Artificial Intelligence www.csc.csudh.edu

The “most wins” heuristic applied to the first children in tic-tac-toe Artificial Intelligence www.csc.csudh.edu

Heuristically reduced state space for tic-tac-toe Artificial Intelligence CSC411 Artificial Intelligence www.csc.csudh.edu

Simple Heuristic for Tic Tac Toe: Move to the square in which X has the most winning lines Using this rule, we can see that a corner square has heuristic value of 3, a side square has a heuristic value of 2, but the centre square has a heuristic value of 4. So we can prune the left and right branches of the search tree. This removes 2/3 of the search space on the first move. If we apply the heuristic at each level of the search, we will remove most of the states from consideration thereby greatly improving the efficiency of the search. Artificial Intelligence www.csc.csudh.edu

Implementation of Heuristic Search Heuristic search is implemented in two parts: The heuristic measure. The search algorithm. Artificial Intelligence www.csc.csudh.edu

Hill Climbing Use heuristic to move only to states that are better than the current state. Always move to better state when possible. The process ends when all operators have been applied and none of the resulting states are better than the current state. Artificial Intelligence www.csc.csudh.edu

Potential Problems with Simple Hill Climbing Will terminate when at local optimum. The order of application of operators can make a big difference. Can’t see past a single move in the state space Artificial Intelligence www.csc.csudh.edu

The local maximum problem for hill-climbing with 3-level look ahead Insert fig 4.4 Artificial Intelligence www.csc.csudh.edu

The Best-First Search Also heuristic search – use heuristic (evaluation) function to select the best state to explore Can be implemented with a priority queue Breadth-first implemented with a queue Depth-first implemented with a stack Artificial Intelligence www.csc.csudh.edu

The best-first search algorithm Artificial Intelligence www.csc.csudh.edu

Heuristic search of a hypothetical state space Artificial Intelligence www.csc.csudh.edu

A trace of the execution of best-first-search Artificial Intelligence www.csc.csudh.edu

Heuristic search of a hypothetical state space with open and closed states highlighted Artificial Intelligence www.csc.csudh.edu

Implement Heuristic Evaluation Function Heuristics can be evaluated in different ways 8-puzzle problem Heuristic 1: count the tiles out of places compared with the goal state Heuristic 2: sum all the distances by which the tiles are out of pace, one for each square a tile must be moved to reach its position in the goal state Heuristic 3: multiply a small number (say, 2) times each direct tile reversal (where two adjacent tiles must be exchanged to be in the order of the goal) Artificial Intelligence www.csc.csudh.edu

The start state, first moves, and goal state for an example-8 puzzle Insert fig 4.12 Artificial Intelligence www.csc.csudh.edu

Three heuristics applied to states in the 8-puzzle Artificial Intelligence www.csc.csudh.edu

Heuristic Design Use the limited information available in a single state to make intelligent choices Empirical, judgment, and intuition Must be its actual performance on problem instances The solution path consists of two parts: from the starting state to the current state, and from the current state to the goal state The first part can be evaluated using the known information The second part must be estimated using unknown information The total evaluation can be f(n) = g(n) + h(n) g(n) – from the starting state to the current state n h(n) – from the current state n to the goal state Artificial Intelligence www.csc.csudh.edu

The heuristic f applied to states in the 8-puzzle Insert fig 4.15 Artificial Intelligence www.csc.csudh.edu

State space generated in heuristic search of the 8-puzzle graph Insert fig 4.16 Artificial Intelligence www.csc.csudh.edu

The successive stages of open and closed that generate the graph are: Artificial Intelligence www.csc.csudh.edu

Open and closed as they appear after the 3rd iteration of heuristic search Artificial Intelligence www.csc.csudh.edu

Analysis of the evaluation function evaluation function for the states in a search space, you are interested in two things: g(n): How far is state n from the start state? h(n): How far is state n from a goal state? Evaluation function. This gives us the following evaluation function: f(n) = g(n) + h(n) where g(n) measures the actual length of the path from the start state to the state n, and h(n) is a heuristic estimate of the distance from a state n to a goal state. Artificial Intelligence www.csc.csudh.edu

Heuristic search and expert systems Expert System employ confidence measures to select the conclusions with the highest likelihood of the success through heuristics implementation. Artificial Intelligence www.csc.csudh.edu

Admissibility, Monotonicity, and Informedness A best-first search algorithm guarantee to find a best path, if exists, if the algorithm is admissible. A best-first search algorithm is admissible if its heuristic function h is monotone. Artificial Intelligence www.csc.csudh.edu

Admissibility and Algorithm A* Insert def box page 146 Artificial Intelligence www.csc.csudh.edu

Monotonicity and Informedness Insert def box, pg 147 Artificial Intelligence www.csc.csudh.edu

Comparison of state space searched using heuristic search with space searched by breadth-first search. The proportion of the graph searched heuristically is shaded. The optimal search selection is in bold. Heuristic used is f(n) = g(n) + h(n) where h(n) is tiles out of place. Artificial Intelligence www.csc.csudh.edu

Minimax Procedure Games A variant of game nim Two players attempting to win Two opponents are referred to as MAX and MIN A variant of game nim A number of tokens on a table between the 2 opponents Each player divides a pile of tokens into two nonempty piles of different sizes The player who cannot make division losses Artificial Intelligence www.csc.csudh.edu

Exhaustive Search State space for a variant of nim. Each state partitions the seven matches into one or more piles Artificial Intelligence www.csc.csudh.edu

Maxmin Search Principles Value propagating rules MAX tries to win by maximizing her score, moves to a state that is best for MAX MIN, the opponent, tries to minimize the MAX’s score, moves to a state that is worst for MAX Both share the same information MIN moves first The terminating state that MAX wins is scored 1, otherwise 0 Other states are valued by propagating the value of terminating states Value propagating rules If the parent state is a MAX node, it is given the maximum value among its children If the parent state is a MIN state, it is given the minimum value of its children Artificial Intelligence www.csc.csudh.edu

Exhaustive minimax for the game of nim Exhaustive minimax for the game of nim. Bold lines indicate forced win for MAX. Each node is marked with its derived value (0 or 1) under minimax. Insert fig 4.20 Artificial Intelligence www.csc.csudh.edu

Minmaxing to Fixed Ply Depth If cannot expand the state space to terminating (leaf) nodes (explosive), can use the fixed ply depth Search to a predefined number, n, of levels from the starting state, n-ply look-ahead The problem is how to value the nodes at the predefined level – heuristics Propagating values is similar Maximum children for MAX nodes Minimum children for MIN nodes Artificial Intelligence www.csc.csudh.edu

Minimax to a hypothetical state space Minimax to a hypothetical state space. Leaf states show heuristic values; internal states show backed-up values. Insert fig 4.21 Artificial Intelligence www.csc.csudh.edu

Heuristic measuring conflict applied to states of tic-tac-toe Artificial Intelligence www.csc.csudh.edu

Two-ply minimax applied to the opening move of tic-tac-toe Artificial Intelligence www.csc.csudh.edu

Two ply minimax, and one of two possible MAX second moves Artificial Intelligence www.csc.csudh.edu

Two-ply minimax applied to X’s move near the end of the game Artificial Intelligence www.csc.csudh.edu

Alpha-Beta Procedure Alpha-beta pruning to improve search efficiency Proceeds in a depth-first fashion and creates two values alpha and beta during the search Alpha associated with MAX nodes, and never decreases Beta associated with MIN nodes, never increases To begin, descend to full ply depth in a depth-first search, and apply heuristic evaluation to a state and all its siblings. The value propagation is the same as minimax procedure Next, descend to other grandchildren and terminate exploration if any of their values is >= this beta value Terminating criteria Below any MIN node having beta <= alpha of any of its MAX ancestors Below any MAX node having alpha >= beta of any of its MIN ancestors Artificial Intelligence www.csc.csudh.edu

Artificial Intelligence www.csc.csudh.edu