1 Using Search in Problem Solving Part II. 2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Heuristic Search techniques
For Friday Finish chapter 5 Program 1, Milestone 1 due.
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
5-1 Chapter 5 Tree Searching Strategies. 5-2 Satisfiability problem Tree representation of 8 assignments. If there are n variables x 1, x 2, …,x n, then.
Search Techniques MSc AI module. Search In order to build a system to solve a problem we need to: Define and analyse the problem Acquire the knowledge.
CS 484 – Artificial Intelligence1 Announcements Department Picnic: today, after class Lab 0 due today Homework 2 due Tuesday, 9/18 Lab 1 due Thursday,
Chapter 4 Search Methodologies.
Artificial Intelligence (CS 461D)
Search in AI.
Best-First Search: Agendas
Mahgul Gulzai Moomal Umer Rabail Hafeez
Problem Solving by Searching
This time: Outline Game playing The minimax algorithm
Review: Search problem formulation
CS 561, Sessions Administrativia Assignment 1 due tuesday 9/24/2002 BEFORE midnight Midterm exam 10/10/2002.
Using Search in Problem Solving
CS 561, Sessions Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first.
1 Chapter 4 Search Methodologies. 2 Chapter 4 Contents l Brute force search l Depth-first search l Breadth-first search l Properties of search methods.
November 10, 2009Introduction to Cognitive Science Lecture 17: Game-Playing Algorithms 1 Decision Trees Many classes of problems can be formalized as search.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
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.
Using Search in Problem Solving
CS 460, Sessions Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first.
Uninformed Search Reading: Chapter 3 by today, Chapter by Wednesday, 9/12 Homework #2 will be given out on Wednesday DID YOU TURN IN YOUR SURVEY?
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Using Search in Problem Solving
Machine Learning and Review Reading: C Bayesian Approach  Each observed training example can incrementally decrease or increase probability of.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
1 Midterm Review cmsc421 Fall Outline Review the material covered by the midterm Questions?
For Friday Finish chapter 3 Homework: –Chapter 3, exercise 6 –May be done in groups. –Clarification on part d: an “action” must be running the program.
Brute Force Search Depth-first or Breadth-first search
Heuristic Search Heuristic - a “rule of thumb” used to help guide search often, something learned experientially and recalled when needed Heuristic Function.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Copyright R. Weber Search in Problem Solving Search in Problem Solving INFO 629 Dr. R. Weber.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Informed Search Strategies
Problem Solving and Search Andrea Danyluk September 11, 2013.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Copyright R. Weber Search in Problem Solving ISYS 370 Dr. R. Weber.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Artificial Intelligence: Planning Lecture 6 Problems with state space search Planning Operators A Simple Planning Algorithm (Game Playing)
Heuristic Search In addition to depth-first search, breadth-first search, bound depth-first search, and iterative deepening, we can also use informed or.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
A RTIFICIAL I NTELLIGENCE UNIT : 2 Search Techniques.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Lecture 7: Uninformed Search Dr John Levine Algorithms and Complexity February 13th 2006.
Search exploring the consequences of possible actions.
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 Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Search exploring the consequences of possible actions.
Lecture 3: Uninformed Search
For Friday Finish chapter 6 Program 1, Milestone 1 due.
For Friday Read chapter 4, sections 1 and 2 Homework –Chapter 3, exercise 7 –May be done in groups.
Search (continued) CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
Knowledge Search CPTR 314.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
Searching for Solutions
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Best-first search is a search algorithm which explores a graph by expanding the most promising node chosen according to a specified rule.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Chapter 3 Solving problems by searching. Search We will consider the problem of designing goal-based agents in observable, deterministic, discrete, known.
Artificial Intelligence Solving problems by searching.
Last time: search strategies
Chapter 10: Algorithm Design Techniques
Presentation transcript:

1 Using Search in Problem Solving Part II

2 Basic Concepts Basic concepts: Initial state Goal/Target state Intermediate states Path from the initial to the target state Operators/rules to get from one state to another All states - search space We search for a path / sequence of operators to go from the initial state to the goal state

3 Search methods Basic (uninformed): Basic (uninformed): breadth-first breadth-first depth-first depth-first Heuristic (informed): Heuristic (informed): hill climbing, hill climbing, best-first, best-first, A* A*

4 Heuristic Search Heuristic search is used to reduce the search space. Basic idea: explore only promising states/paths. We need an evaluation function to estimate each state/path.

5 Hill climbing Basic idea: always head towards a state which is better than the current one. There is no exhaustive search, so no node list is maintained. If a solution is found, it is found for a very short time and with minimum memory requirements. However it is not guaranteed that a solution will be found - the local maxima problem.

6 Hill Climbing - Algorithm Start with current-state = initial-state. Until current-state = goal-state OR there is no change in current-state do: Get the successors of the current state and use the evaluation function to assign a score to each successor. If one of the successors has a better score than the current-state then set the new current-state to be the successor with the best score.

7 Hill Climbing Node list is not maintained Node list is not maintained No problems with loops as we move to a better node No problems with loops as we move to a better node If a solution is found, it is found for a very short time with minimal memory requirements If a solution is found, it is found for a very short time with minimal memory requirements Finding a solution is not guaranteed – the local maxima problem Finding a solution is not guaranteed – the local maxima problem

8 Best First Search The node with the best score is chosen to be expanded. Works in breadth-first manner, keeps a data structure (called agenda, based on priority queues) of all successors and their scores. If a node that has been chosen does not lead to a solution, the next "best" node is chosen, so eventually the solution is found Always finds a solution, not guaranteed to be the optimal one.

9 Best First Search Algorithm 1.Start with agenda = [initial-state]. 2.While agenda is not empty do A. Pick the best node on agenda. B. If it is the goal node then return with success. Otherwise find its successors. C. Assign the successor nodes a score using the evaluation function and add the scored nodes to the agenda

10 Comparison with hill-climbing Similarities: best-first always chooses the best node Difference: best-first search keeps an agenda as in breadth-first search, and in case of a dead end it will backtrack, choosing the next- best node.

11 Beam Search Best-first method Best-first method Expands the best few paths at each level Expands the best few paths at each level Has the memory advantages of the depth- first search Has the memory advantages of the depth- first search Not exhaustive and may not find the best solution. Finding a solution is not guaranteed Not exhaustive and may not find the best solution. Finding a solution is not guaranteed

12 The A* Algorithm An evaluation function that accounts for - the cost of the paths - the score of the nodes F(Node) = g(Node) + h(Node) g(Node) - the costs from the initial state to the current node h(Node) - future costs, i.e. node score Disadvantage of A* is the memory requirement - the algorithm keeps records for the entire tree.

13 The A* Algorithm A* always finds the best solution, provided that h(Node) does not overestimate the future costs.

14 Example A B: 9 D : 10 F : 6 H : 5 C: 8 E: 7 K: 5 2 G: 0 J: 4 Start: A Goal: G

15 Search and Problem-solving Generate and Test Generate and Test Means-end analysis in planning Means-end analysis in planning work out the path backwards work out the path backwards use rules with preconditions and effects use rules with preconditions and effects the target goal is the effect of some operator/rule the target goal is the effect of some operator/rule set the conditions as subgoals to be achieved set the conditions as subgoals to be achieved Minimax algorithm in games, Minimax algorithm in games, Alpha-Beta pruning Alpha-Beta pruning Constraint satisfaction Constraint satisfaction

16 Planning Techniques Means-Ends analysis Initial state, Goal state, intermediate states. Operators to change the states. Each operator: Preconditions Effects Go backwards : from the goal to the initial state.

17 Basic Algorithm Put the goal state in a list of subgoals While the list is not empty, do Take a subgoal. Is there an operation that has as an effect this goal state? If no - the problem is not solvable. If yes, put the operation in the plan. Are the preconditions fulfilled? If yes - we have constructed the plan If no - Put the preconditions in the list of subgoals

18 More complex problems Goal state - a set of sub-states Each sub-state is a goal. To achieve the target state we have to achieve each goal in the Target state.

19 Extensions of the basic method Planning with goal protection Planning with goal protection Nonlinear planning Nonlinear planning Hierarchical planning Hierarchical planning Reactive planning Reactive planning

20 Game Playing Systems Special feature of games: there is an opponent that tries to destroy our plans. The search tree (game tree) has to reflect the possible moves of both players

21 Player1 Player2 Player1

22 Minimax procedure Minimax procedure Scoring the final nodes: Winning : 10 Draw : 0 Loosing : -10 Each player is trying to maximize their score and minimize the score of the other player. The levels in the tree for player P1 are maximizing if it is P1's move, and minimizing if it is P2's move.

23 Minimax algorithm Minimax algorithm Build the search tree. Assign scores to the leaves Assign scores to intermediate nodes: If node is a leaf of the search tree - return score of that node Else: If it is a maximizing node return maximum of scores of the successor nodes Else if it is a minimizing node - return minimum of scores of the successor nodes After that, choose nodes with highest score

24 Alpha-Beta Pruning At maximizing level the score is at least the score of any successor. At minimizing level the score is at most the score of any successor.

25 A:10 B:10C: 0 E:10F:10G: 0H:10 I:10J: 0K:10L:-10M:-10N:0O:10P:-10 Maximizing score Minimizing score P1's move P2's move P1's minimax tree

26 Constraint satisfaction search State description: a set of variables. A set of constraints on the assigned values of variables. Each variable may be assigned a value within its domain, and the value must not violate the constraints. Initial state - the variables do not have values Goal state: Variables have values and the constraints are obeyed.

27 Constraint satisfaction search Different types of constraints: Different types of constraints: unary - on one variable only unary - on one variable only binary - on two variables, etc. binary - on two variables, etc.

28 Example WEEK LOAN WEEK + LOAN + WEEK LOAN WEEK DEBT MONTH

29 Example - continued The problem is to assign a digit to each letter, with different letters being different digits, so that when the letters are replaced by the digits, the addition is done correctly. Initially no letters have values. The goal state would be an assignment of values so that the addition is correct. Operators: assign a digit to a letter, so that no two different digits have same values, and the addition rules are not violated.