Search and Optimization

Size: px
Start display at page:

Download "Search and Optimization"

Transcription

1 Search and Optimization

2 Search, Optimization and Game-Playing The goal is to find one or more optimal or sub-optimal solutions in a given search space. We can either be interested in finding any one solution or interested in finding the best solution determined by some measure. Some examples of search and optimization problems. Laying out VLSI circuits. Planning the motion of robotic arms. Airline crew scheduling. Game playing. Theorem proving.

3 Techniques Divide-and-Conquer. Backtracking. Branch and Bound. Alpha-Beta Pruning.

4 Search Trees The search space is the set of all possible solutions and non-solutions that are valid configurations for the given problem. The search space is represented by a search tree with the following characteristics. Each node represents a problem or sub-problem. The root of the tree represents the original problem. Child nodes are created by adding constraints to the problem.we can have two kinds of nodes: AND-node: All child nodes must be solved to solve the problem at this node. OR-node: Any child node can be solved to solve the problem at this node.

5 Types of Search Trees AND-tree: All nodes are AND-nodes. Use Divide-and-Conquer to solve. OR-tree. All nodes are OR-nodes. Use Backtracking with Branch and Bound to solve. AND/OR-tree. Min-Max trees are examples that are used for game playing. Use Alpha-Beta Pruning.

6 Backtrack Search Uses recursive depth-first search to explore the search space. Depth-first search keeps going down a path as long as it can. If it reaches a node with no children ( dead end ), then it back tracks to its parent and tries another child node that it hasn t already explored. If it has explored all child nodes, then it backtracks up one more level and continues. If the average branching factor is b and the depth of the search tree is k, then backtrack search requires O(b k ) time, which is exponential. Classic examples of problems requiring backtrack search.

7 Backtrack Search Uses recursive depth-first search to explore the search space. Depth-first search keeps going down a path as long as it can. If it reaches a node with no children ( dead end ), then it back tracks to its parent and tries another child node that it hasn t already explored. If it has explored all child nodes, then it backtracks up one more level and continues. If the average branching factor is b and the depth of the search tree is k, then backtrack search requires O(b k ) time, which is exponential. Classic examples of problems requiring backtrack search. -queens problem. How to place queens on a chessboard such that none of the queens can take another queen? Generalize to n-queens problem. Knight s Tour. Is there a sequence of moves for a knight on a chess board such that it covers the whole board and lands on each square once and only once during its tour? Again generalize to n n board. Creating a crossword puzzle.

8 Sequential N-Queens (Java version) public boolean placequeens(int n) { if (n > size) return false; if (n == 0) return true; } int i = 0; int j = 0; while (true) { if (checkpos(i,j)) { board[i][j] = true; if (placequeens(n-)) return true; else board[i][j] = false; } j++; if (j == size) { j = 0; i++; if (i == size) return false; } }

9 Faster Sequential N-Queens (Java version) public boolean fasterplacequeens(int n) { if (n > size) return false; if (n == 0) return true; for (int i=0; i < size; i++) if (checkpos(size-n,i)) { board[size-n][i]=true; if (fasterplacequeens(n-)) return true; else board[size-n][i]=false; } return false; }

10 Parallel Backtrack Search: Algorithm I Each process works on one subtree. Assume that the number of processes is p = b r. Each process searches the tree until depth r using the sequential algorithm. Then each process picks one subtree to work on. If the depth of the search tree is greater than r, then the time for the first step is inconsequential. Search trees are unbalanced. We can get better load balancing by letting each process explore until some depth m such that b m >> p. Then each process picks up its share of subtrees (from different parts of the search tree). The trade-off is that increasing m results in computations being performed that the sequential algorithm would have avoided.

11 Parallel Backtrack Search: Algorithm II In the previous algorithm we used depth-first search to the point where we had p subtrees. But that could lead to load balancing problems. In this algorithm we will run the depth-first search longer, generating several subtrees per process.

12 Branch and Bound Branch and bound is a variant of backtracking search that takes advantage of information about the optimality of partial solutions to avoid considering solutions that cannot be optimal. So we are still doing an exhaustive search but potentially avoiding exploring large parts of the search space that are not going to give us a solution. Given an initial problem and some objective function f to be minimized, the branch and bound technique works as follows.

13 Branch and Bound Branch and bound is a variant of backtracking search that takes advantage of information about the optimality of partial solutions to avoid considering solutions that cannot be optimal. So we are still doing an exhaustive search but potentially avoiding exploring large parts of the search space that are not going to give us a solution. Given an initial problem and some objective function f to be minimized, the branch and bound technique works as follows. If the problem is small enough, then solve it directly. Otherwise the problem is decomposed into two or more subproblems. Each subproblem is characterized by the inclusion of one or more constraints. For each subproblem, we compute a lower bounding function g. This lower bound represents the smallest possible cost of a solution to the subproblem, given the constraints on the given subproblem.

14 Branch and Bound Branch and bound is a variant of backtracking search that takes advantage of information about the optimality of partial solutions to avoid considering solutions that cannot be optimal. So we are still doing an exhaustive search but potentially avoiding exploring large parts of the search space that are not going to give us a solution. Given an initial problem and some objective function f to be minimized, the branch and bound technique works as follows. If the problem is small enough, then solve it directly. Otherwise the problem is decomposed into two or more subproblems. Each subproblem is characterized by the inclusion of one or more constraints. For each subproblem, we compute a lower bounding function g. This lower bound represents the smallest possible cost of a solution to the subproblem, given the constraints on the given subproblem. On any path from the root to a leaf node, the lower bounds are always nondecreasing. The issues are: How are the problems generated? How is a particular subproblem selected as the point to continue the search? How are hopeless subproblems discarded? How does the algorithm terminate?

15 Branch and Bound Example: -puzzle -puzzle. Move the tiles such that the tiles are in row major ordering. The goal is to minimize the number of moves to get at the solution. State space tree: The tree of possible board positions. Lower bounding function: The total of the number of moves made so far and the sum of Manhattan distance between each out of place tile and its correct location.

16 Branch and Bound Example: -puzzle -puzzle. Move the tiles such that the tiles are in row major ordering. The goal is to minimize the number of moves to get at the solution. State space tree: The tree of possible board positions. Lower bounding function: The total of the number of moves made so far and the sum of Manhattan distance between each out of place tile and its correct location. The search proceeds from the node having the smallest value. If two or more nodes have the same value, then the search proceeds from the node farthest from the root. (Why?)

17 State Space Tree for -puzzle

18 Branch and Bound Solution for the -puzzle

19 Parallel Branch and Bound Use a distributed priority queue of unexamined problems one queue per process. Each iteration, a process removes the unexamined subproblem with lowest bound from the priority queue and either solves it directly or divides it into subproblems. It sends one unexamined subproblem to another process and receives (on average) one unexamined subproblem from another process.

20 Parallel Branch and Bound Use a distributed priority queue of unexamined problems one queue per process. Each iteration, a process removes the unexamined subproblem with lowest bound from the priority queue and either solves it directly or divides it into subproblems. It sends one unexamined subproblem to another process and receives (on average) one unexamined subproblem from another process. The performance depends upon the heuristic used by the processes to exchange unexamined subproblems in order to load balance. Here are some common heuristics. Keep newly created subproblem with the lower bound and send the problem with the higher bound. (average to poor performance) Put both newly created subproblems into local queue, delete the second best problem from the local queue and send it. (best performance) Put both newly created subproblems into local queue, delete the best problem from the local queue and send it. (second best performance)

21 Parallel Branch and Bound Use a distributed priority queue of unexamined problems one queue per process. Each iteration, a process removes the unexamined subproblem with lowest bound from the priority queue and either solves it directly or divides it into subproblems. It sends one unexamined subproblem to another process and receives (on average) one unexamined subproblem from another process. The performance depends upon the heuristic used by the processes to exchange unexamined subproblems in order to load balance. Here are some common heuristics. Keep newly created subproblem with the lower bound and send the problem with the higher bound. (average to poor performance) Put both newly created subproblems into local queue, delete the second best problem from the local queue and send it. (best performance) Put both newly created subproblems into local queue, delete the best problem from the local queue and send it. (second best performance) Conditions for an optimal solution. At least one of the solution nodes must be examined. Processes must examine all nodes in the state space tree that have lower bounds less than the candidate solution.

22 Anomalies in Parallel Branch and Bound Increasing the number of processors could lead to a slow down. = = = = = B A = = > n > = = = = = =... k levels > > > Superlinear speedup, though rare, is also possible. n

23 Game Trees A two player game tree represents possible outcomes in a two person game. The leaf nodes represent outcomes of the game, interior nodes represent intermediate conditions. The scores are in terms of the first player: positive means first player wins, negative means the second player is winning. The root represents the first player, the second level the second player, the third level the first player and so on. The minmax algorithm assumes that the second player tries to minimize the gain of the first player, while the first player tries to maximize her or his gain. The chess game tree has about possible nodes, which are far too many for to evaluate completely.

24 Game Tree max st player nd player min max 9 min 9 A Game Tree

25 Alpha-Beta Pruning The deeper the search in the game tree, the better the quality of play. Alpha-beta pruning avoids searching subtrees whose evaluation cannot influence the outcome of the search, that is, cannot change the choice of a move. Hence it allows a deeper search in the same amount of time. When the search reaches a node, some choice of moves has already been considered that leads to a value of at least α for the first player. We also know that correct play on the part of the second player cannot get a value more than β. Thus [α..β] defines a window for the search. Then we have three cases: If the node pos is a max-node, then it is the first player s move. If val, the value of the game tree searched from node pos is greater than α, then α is changed to val, a better line of play has been found for player one. If the node pos is a min-node, then it is the second player s move. If val, the value of the game tree searched from node pos is less than β, then β is changed to val, a better line of play has been found for player two. If the value of α exceeds β, there is no need to search further. It is in the best interests of one of the players to block the line of play leading to node pos.

26 Alpha-Beta Pruning st player nd player max min max min 9 9 Alpha Beta Pruning

27 Sequential Alpha-Beta Pruning Alpha-Beta(pos, α, β, depth) // α lower cutoff value, by reference // β upper cutoff value, by reference // pos position // depth search depth // maxc maximum possible number of moves // Local // c[... maxc] children of pos in game tree // i iterates through legal moves // val value returned from search // width number of legal moves. if depth 0. then return Evaluate(pos). width Generate.moves(pos). if width = 0. then return Evaluate(pos). cutoff false. i 0. while i width and cutoff = false 9. do val Alpha-Beta(c[i], α, β, depth ) 0. if pos is max-node and val > α. then α val. else if pos is min-node and val < β. then β val. if α < β. then cutoff true. i i +. if pos is max-node. then return α 9. else return β

28 Perfectly Ordered Game Tree Perfectly Ordered Game Tree Root is a Type node. The left child of a Type node is a Type node. Other children are of Type. The left child of a type node is a Type node. All other children can be pruned. All children of a Type nodes are of Type.

29 Improvements on Alpha-Beta Search The alpha-beta pruning algorithm does the most pruning on the perfectly-ordered game tree, that is, a game tree in which the best move from each position is always searched first. Assuming a perfectly-ordered game tree with a depth of d and branching factor of b, the number of leaf nodes examined is: b d/ + b d/ Improvements on the basic alpha-beta pruning. Aspiration search: guess an initial window (v e, v + e) to narrow the search. Iterative Deepening: use of a (d ) level search to prepare for a d level search. Allows the time spent in a search to be controlled. Results of the (d )-ply search can be used to improve the ordering of the d-ply search, making the node ordering be more similar to perfectly-ordered. Also, the value returned by the (d )-ply search can be used as the center of the window for the d-ply aspiration search.

30 Parallel Alpha-Beta Pruning Parallel Aspirational Search. Divide into ranges and search in parallel. This is a generalization of aspiration search, Speedup is limited to or. Parallel Subtree Evaluation. Minimizing communication overhead. Split the game tree at the root and give every processor an equal share of the subtrees. Let each processor perform an independent alpha-beta search with the window [, + ]. Leads to poor speedup because the game tree is imbalanced. Minimizing search overhead. The parallel algorithm prunes the same nodes as the sequential algorithm. This is achieved by delaying the search in some subtrees until more accurate bounds information is available.

31 Distributed Tree Search Suitable for solving a variety of tree-search problems. Assigns processes to the nodes of the search tree. Each process controls one or more processors. The assignment is dynamic and we keep track of parent-child relationships. When a process is assigned to a nonterminal node, it generates the children of that node by evaluating the legal moves. Then the process assigns processors to children node based on the allocation strategy. For example, in breadth-first scheme, one processor is allocated to each child node until there are not more processors. Then a new process is created for each child node that is allocated at least one processor. The parent process suspends until it receives a message from another process. When a process is assigned to a terminal node, it returns the value of that node and its set of allocated processors to the parent and then terminates.

32 Distributed Tree Search (continued) The first child to complete the search of its subtree sends a message with the values of α and β to its parent. When it terminates, it returns its set of processors to the parent. The parent wakes up on receiving a message. It reallocates the freed processors to one or more of its active child processes. It also sends one or more of its child processes the new values of α and β. Branch and Bound processor allocation. When the search reaches a node of type node, all processors are allocated to the leftmost child. After the search returns with cutoff bounds from the subtree rooted by the leftmost child, the processors are assigned to the remaining children in a breadth-first manner. When the search reaches a type or node, cutoff bounds already exist, and the processors are assigned in a breadth-first manner

Parallel Programming. Parallel algorithms Combinatorial Search

Parallel Programming. Parallel algorithms Combinatorial Search Parallel Programming Parallel algorithms Combinatorial Search Some Combinatorial Search Methods Divide and conquer Backtrack search Branch and bound Game tree search (minimax, alpha-beta) 2010@FEUP Parallel

More information

Algorithm Design Techniques (III)

Algorithm Design Techniques (III) Algorithm Design Techniques (III) Minimax. Alpha-Beta Pruning. Search Tree Strategies (backtracking revisited, branch and bound). Local Search. DSA - lecture 10 - T.U.Cluj-Napoca - M. Joldos 1 Tic-Tac-Toe

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Dr. Malek Mouhoub Department of Computer Science University of Regina Fall 2005 Malek Mouhoub, CS820 Fall 2005 1 3. State-Space Search 3. State-Space Search Graph Theory Uninformed

More information

APHID: Asynchronous Parallel Game-Tree Search

APHID: Asynchronous Parallel Game-Tree Search APHID: Asynchronous Parallel Game-Tree Search Mark G. Brockington and Jonathan Schaeffer Department of Computing Science University of Alberta Edmonton, Alberta T6G 2H1 Canada February 12, 1999 1 Running

More information

Monte Carlo Methods; Combinatorial Search

Monte Carlo Methods; Combinatorial Search Monte Carlo Methods; Combinatorial Search Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico November 22, 2012 CPD (DEI / IST) Parallel and

More information

Combinatorial Search; Monte Carlo Methods

Combinatorial Search; Monte Carlo Methods Combinatorial Search; Monte Carlo Methods Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico May 02, 2016 CPD (DEI / IST) Parallel and Distributed

More information

CPSC 436D Video Game Programming

CPSC 436D Video Game Programming CPSC 436D Video Game Programming Strategy & Adversarial Strategy Strategy Given current state, determine BEST next move Short term: best among immediate options Long term: what brings something closest

More information

Algorithm Design Techniques. Hwansoo Han

Algorithm Design Techniques. Hwansoo Han Algorithm Design Techniques Hwansoo Han Algorithm Design General techniques to yield effective algorithms Divide-and-Conquer Dynamic programming Greedy techniques Backtracking Local search 2 Divide-and-Conquer

More information

Midterm Examination CS540-2: Introduction to Artificial Intelligence

Midterm Examination CS540-2: Introduction to Artificial Intelligence Midterm Examination CS540-2: Introduction to Artificial Intelligence March 15, 2018 LAST NAME: FIRST NAME: Problem Score Max Score 1 12 2 13 3 9 4 11 5 8 6 13 7 9 8 16 9 9 Total 100 Question 1. [12] Search

More information

Lecture 5: Search Algorithms for Discrete Optimization Problems

Lecture 5: Search Algorithms for Discrete Optimization Problems Lecture 5: Search Algorithms for Discrete Optimization Problems Definitions Discrete optimization problem (DOP): tuple (S, f), S finite set of feasible solutions, f : S R, cost function. Objective: find

More information

Downloaded from ioenotes.edu.np

Downloaded from ioenotes.edu.np Chapter- 3: Searching - Searching the process finding the required states or nodes. - Searching is to be performed through the state space. - Search process is carried out by constructing a search tree.

More information

UNIT 4 Branch and Bound

UNIT 4 Branch and Bound UNIT 4 Branch and Bound General method: Branch and Bound is another method to systematically search a solution space. Just like backtracking, we will use bounding functions to avoid generating subtrees

More information

3 SOLVING PROBLEMS BY SEARCHING

3 SOLVING PROBLEMS BY SEARCHING 48 3 SOLVING PROBLEMS BY SEARCHING A goal-based agent aims at solving problems by performing actions that lead to desirable states Let us first consider the uninformed situation in which the agent is not

More information

Heuristic (Informed) Search

Heuristic (Informed) Search Heuristic (Informed) Search (Where we try to choose smartly) R&N: Chap., Sect..1 3 1 Search Algorithm #2 SEARCH#2 1. INSERT(initial-node,Open-List) 2. Repeat: a. If empty(open-list) then return failure

More information

3.6.2 Generating admissible heuristics from relaxed problems

3.6.2 Generating admissible heuristics from relaxed problems 3.6.2 Generating admissible heuristics from relaxed problems To come up with heuristic functions one can study relaxed problems from which some restrictions of the original problem have been removed The

More information

Chapter-6 Backtracking

Chapter-6 Backtracking Chapter-6 Backtracking 6.1 Background Suppose, if you have to make a series of decisions, among various choices, where you don t have enough information to know what to choose. Each decision leads to a

More information

Chapter 3: Solving Problems by Searching

Chapter 3: Solving Problems by Searching Chapter 3: Solving Problems by Searching Prepared by: Dr. Ziad Kobti 1 Problem-Solving Agent Reflex agent -> base its actions on a direct mapping from states to actions. Cannot operate well in large environments

More information

Backtracking and Branch-and-Bound

Backtracking and Branch-and-Bound Backtracking and Branch-and-Bound Usually for problems with high complexity Exhaustive Search is too time consuming Cut down on some search using special methods Idea: Construct partial solutions and extend

More information

Parallel Combinatorial Search on Computer Cluster: Sam Loyd s Puzzle

Parallel Combinatorial Search on Computer Cluster: Sam Loyd s Puzzle Parallel Combinatorial Search on Computer Cluster: Sam Loyd s Puzzle Plamenka Borovska Abstract: The paper investigates the efficiency of parallel branch-and-bound search on multicomputer cluster for the

More information

HEURISTIC SEARCH. 4.3 Using Heuristics in Games 4.4 Complexity Issues 4.5 Epilogue and References 4.6 Exercises

HEURISTIC SEARCH. 4.3 Using Heuristics in Games 4.4 Complexity Issues 4.5 Epilogue and References 4.6 Exercises 4 HEURISTIC SEARCH Slide 4.1 4.0 Introduction 4.1 An Algorithm for Heuristic Search 4.2 Admissibility, Monotonicity, and Informedness 4.3 Using Heuristics in Games 4.4 Complexity Issues 4.5 Epilogue and

More information

4 INFORMED SEARCH AND EXPLORATION. 4.1 Heuristic Search Strategies

4 INFORMED SEARCH AND EXPLORATION. 4.1 Heuristic Search Strategies 55 4 INFORMED SEARCH AND EXPLORATION We now consider informed search that uses problem-specific knowledge beyond the definition of the problem itself This information helps to find solutions more efficiently

More information

Artificial Intelligence CS 6364

Artificial Intelligence CS 6364 Artificial Intelligence CS 6364 Professor Dan Moldovan Section 4 Informed Search and Adversarial Search Outline Best-first search Greedy best-first search A* search Heuristics revisited Minimax search

More information

Articial Intelligence Search Algorithms. Richard E. Korf. University of California, Los Angeles. Los Angeles, Ca

Articial Intelligence Search Algorithms. Richard E. Korf. University of California, Los Angeles. Los Angeles, Ca Articial Intelligence Search Algorithms Richard E. Korf Computer Science Department University of California, Los Angeles Los Angeles, Ca. 90095 July 5, 1996 1 Introduction Search is a universal problem-solving

More information

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3)

Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.) Some slides adapted from Richard Lathrop, USC/ISI, CS 7 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always replies

More information

Search Algorithms for Discrete Optimization Problems

Search Algorithms for Discrete Optimization Problems Search Algorithms for Discrete Optimization Problems Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text ``Introduction to Parallel Computing'', Addison Wesley, 2003. 1 Topic

More information

Basic Search Algorithms

Basic Search Algorithms Basic Search Algorithms Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Abstract The complexities of various search algorithms are considered in terms of time, space, and cost

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence CSC348 Unit 3: Problem Solving and Search Syedur Rahman Lecturer, CSE Department North South University syedur.rahman@wolfson.oxon.org Artificial Intelligence: Lecture Notes The

More information

Uninformed Search Methods

Uninformed Search Methods Uninformed Search Methods Search Algorithms Uninformed Blind search Breadth-first uniform first depth-first Iterative deepening depth-first Bidirectional Branch and Bound Informed Heuristic search Greedy

More information

State Space Search. Many problems can be represented as a set of states and a set of rules of how one state is transformed to another.

State Space Search. Many problems can be represented as a set of states and a set of rules of how one state is transformed to another. State Space Search Many problems can be represented as a set of states and a set of rules of how one state is transformed to another. The problem is how to reach a particular goal state, starting from

More information

Lecture 14: March 9, 2015

Lecture 14: March 9, 2015 324: tate-space, F, F, Uninformed earch. pring 2015 Lecture 14: March 9, 2015 Lecturer: K.R. howdhary : Professor of (VF) isclaimer: These notes have not been subjected to the usual scrutiny reserved for

More information

Set 2: State-spaces and Uninformed Search. ICS 271 Fall 2015 Kalev Kask

Set 2: State-spaces and Uninformed Search. ICS 271 Fall 2015 Kalev Kask Set 2: State-spaces and Uninformed Search ICS 271 Fall 2015 Kalev Kask You need to know State-space based problem formulation State space (graph) Search space Nodes vs. states Tree search vs graph search

More information

Backtracking. Chapter 5

Backtracking. Chapter 5 1 Backtracking Chapter 5 2 Objectives Describe the backtrack programming technique Determine when the backtracking technique is an appropriate approach to solving a problem Define a state space tree for

More information

Artificial Intelligence (part 4d)

Artificial Intelligence (part 4d) Artificial Intelligence (part 4d) BEHAVIOR OF HEURISTICS EVALUATIONS (USING HEURISTICS IN GAMES) Course Contents Again..Selected topics for our course. Covering all of AI is impossible! Key topics include:

More information

Artificial Intelligence (part 4d)

Artificial Intelligence (part 4d) Artificial Intelligence (part 4d) BEHAVIOR OF HEURISTICS EVALUATIONS (USING HEURISTICS IN GAMES) HEURISTICS EVALUATIONS: (Admissibility,Monotonicity and Informedness) Admissibility Measures A search is

More information

Artificial Intelligence. Game trees. Two-player zero-sum game. Goals for the lecture. Blai Bonet

Artificial Intelligence. Game trees. Two-player zero-sum game. Goals for the lecture. Blai Bonet Artificial Intelligence Blai Bonet Game trees Universidad Simón Boĺıvar, Caracas, Venezuela Goals for the lecture Two-player zero-sum game Two-player game with deterministic actions, complete information

More information

Chapter 11 Search Algorithms for Discrete Optimization Problems

Chapter 11 Search Algorithms for Discrete Optimization Problems Chapter Search Algorithms for Discrete Optimization Problems (Selected slides) A. Grama, A. Gupta, G. Karypis, and V. Kumar To accompany the text Introduction to Parallel Computing, Addison Wesley, 2003.

More information

CS 380: Artificial Intelligence Lecture #4

CS 380: Artificial Intelligence Lecture #4 CS 380: Artificial Intelligence Lecture #4 William Regli Material Chapter 4 Section 1-3 1 Outline Best-first search Greedy best-first search A * search Heuristics Local search algorithms Hill-climbing

More information

Alpha-Beta Pruning in Mini-Max Algorithm An Optimized Approach for a Connect-4 Game

Alpha-Beta Pruning in Mini-Max Algorithm An Optimized Approach for a Connect-4 Game Alpha-Beta Pruning in Mini-Max Algorithm An Optimized Approach for a Connect-4 Game Rijul Nasa 1, Rishabh Didwania 2, Shubhranil Maji 3, Vipul Kumar 4 1,2,3,4 Dept. of Computer Science & Engineering, The

More information

Informed (Heuristic) Search. Idea: be smart about what paths to try.

Informed (Heuristic) Search. Idea: be smart about what paths to try. Informed (Heuristic) Search Idea: be smart about what paths to try. 1 Blind Search vs. Informed Search What s the difference? How do we formally specify this? A node is selected for expansion based on

More information

Distributed Tree Searc and its Application to Alpha-Beta Pruning*

Distributed Tree Searc and its Application to Alpha-Beta Pruning* From: AAAI-88 Proceedings. Copyright 1988, AAAI (www.aaai.org). All rights reserved. Distributed Tree Searc and its Application to Alpha-Beta Pruning* Chris Ferguson and Richard E. Korf Computer Science

More information

Downloded from: CSITauthority.blogspot.com

Downloded from: CSITauthority.blogspot.com [Unit : Searching] (CSC 355) Central Department of Computer Science & Information Technology Tribhuvan University 1 Searching search problem Figure below contains a representation of a map. The nodes represent

More information

CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false.

CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false. Name: Class: Date: CSCI-401 Examlet #5 True/False Indicate whether the sentence or statement is true or false. 1. The root node of the standard binary tree can be drawn anywhere in the tree diagram. 2.

More information

Search Algorithms. Uninformed Blind search. Informed Heuristic search. Important concepts:

Search Algorithms. Uninformed Blind search. Informed Heuristic search. Important concepts: Uninformed Search Search Algorithms Uninformed Blind search Breadth-first uniform first depth-first Iterative deepening depth-first Bidirectional Branch and Bound Informed Heuristic search Greedy search,

More information

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS

CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS CSE 100: B+ TREE, 2-3 TREE, NP- COMPLETNESS Analyzing find in B-trees Since the B-tree is perfectly height-balanced, the worst case time cost for find is O(logN) Best case: If every internal node is completely

More information

CS61B Lecture #35. [The Lecture #32 notes covered lectures #33 and #34.] Today: Enumerated types, backtracking searches, game trees.

CS61B Lecture #35. [The Lecture #32 notes covered lectures #33 and #34.] Today: Enumerated types, backtracking searches, game trees. CS61B Lecture #35 [The Lecture #32 notes covered lectures #33 and #34.] Today: Enumerated types, backtracking searches, game trees. Coming Up: Graph Structures: DSIJ, Chapter 12 Last modified: Mon Nov

More information

Advanced A* Improvements

Advanced A* Improvements Advanced A* Improvements 1 Iterative Deepening A* (IDA*) Idea: Reduce memory requirement of A* by applying cutoff on values of f Consistent heuristic function h Algorithm IDA*: 1. Initialize cutoff to

More information

CAP 4630 Artificial Intelligence

CAP 4630 Artificial Intelligence CAP 4630 Artificial Intelligence Instructor: Sam Ganzfried sganzfri@cis.fiu.edu 1 http://www.ultimateaiclass.com/ https://moodle.cis.fiu.edu/ 2 Solving problems by search 3 8-puzzle 4 8-queens 5 Search

More information

BackTracking Introduction

BackTracking Introduction Backtracking BackTracking Introduction Backtracking is used to solve problems in which a sequence of objects is chosen from a specified set so that the sequence satisfies some criterion. The classic example

More information

mywbut.com Informed Search Strategies-II

mywbut.com Informed Search Strategies-II Informed Search Strategies-II 1 3.3 Iterative-Deepening A* 3.3.1 IDA* Algorithm Iterative deepening A* or IDA* is similar to iterative-deepening depth-first, but with the following modifications: The depth

More information

Midterm Examination CS 540-2: Introduction to Artificial Intelligence

Midterm Examination CS 540-2: Introduction to Artificial Intelligence Midterm Examination CS 54-2: Introduction to Artificial Intelligence March 9, 217 LAST NAME: FIRST NAME: Problem Score Max Score 1 15 2 17 3 12 4 6 5 12 6 14 7 15 8 9 Total 1 1 of 1 Question 1. [15] State

More information

Blind (Uninformed) Search (Where we systematically explore alternatives)

Blind (Uninformed) Search (Where we systematically explore alternatives) Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3 5 1 Simple Problem-Solving-Agent Agent Algorithm 1. s 0 sense/read initial state 2. GOAL? select/read goal

More information

Search Algorithms for Discrete Optimization Problems

Search Algorithms for Discrete Optimization Problems Search Algorithms for Discrete Optimization Problems Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text ``Introduction to Parallel Computing'', Addison Wesley, 2003. Topic

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Information Systems and Machine Learning Lab (ISMLL) Tomáš Horváth 10 rd November, 2010 Informed Search and Exploration Example (again) Informed strategy we use a problem-specific

More information

Chapters 3-5 Problem Solving using Search

Chapters 3-5 Problem Solving using Search CSEP 573 Chapters 3-5 Problem Solving using Search First, they do an on-line search CSE AI Faculty Example: The 8-puzzle Example: The 8-puzzle 1 2 3 8 4 7 6 5 1 2 3 4 5 6 7 8 2 Example: Route Planning

More information

University of Waterloo Department of Electrical and Computer Engineering ECE 457A: Cooperative and Adaptive Algorithms Midterm Examination

University of Waterloo Department of Electrical and Computer Engineering ECE 457A: Cooperative and Adaptive Algorithms Midterm Examination University of Waterloo Department of Electrical and Computer Engineering ECE 457A: Cooperative and Adaptive Algorithms Midterm Examination Exam Date/Time: Tuesday, June 13, 2017, 8:30-9:50 pm Exam Hall:

More information

AI: problem solving and search

AI: problem solving and search : problem solving and search Stefano De Luca Slides mainly by Tom Lenaerts Outline Problem-solving agents A kind of goal-based agent Problem types Single state (fully observable) Search with partial information

More information

Chapter 3. A problem-solving agent is a kind of goal-based agent. It decide what to do by finding sequences of actions that lead to desirable states.

Chapter 3. A problem-solving agent is a kind of goal-based agent. It decide what to do by finding sequences of actions that lead to desirable states. Chapter 3 A problem-solving agent is a kind of goal-based agent. It decide what to do by finding sequences of actions that lead to desirable states. A problem can be defined by four components : 1. The

More information

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE

A4B36ZUI - Introduction ARTIFICIAL INTELLIGENCE A4B36ZUI - Introduction to ARTIFICIAL INTELLIGENCE https://cw.fel.cvut.cz/wiki/courses/a4b33zui/start Michal Pechoucek, Branislav Bosansky, Jiri Klema & Olga Stepankova Department of Computer Science Czech

More information

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario Coping with the Limitations of Algorithm Power Tackling Difficult Combinatorial Problems There are two principal approaches to tackling difficult combinatorial problems (NP-hard problems): Use a strategy

More information

Probabilistic Belief. Adversarial Search. Heuristic Search. Planning. Probabilistic Reasoning. CSPs. Learning CS121

Probabilistic Belief. Adversarial Search. Heuristic Search. Planning. Probabilistic Reasoning. CSPs. Learning CS121 CS121 Heuristic Search Planning CSPs Adversarial Search Probabilistic Reasoning Probabilistic Belief Learning Heuristic Search First, you need to formulate your situation as a Search Problem What is a

More information

CS 188: Artificial Intelligence. Recap Search I

CS 188: Artificial Intelligence. Recap Search I CS 188: Artificial Intelligence Review of Search, CSPs, Games DISCLAIMER: It is insufficient to simply study these slides, they are merely meant as a quick refresher of the high-level ideas covered. You

More information

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH

STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH Slide 3.1 3 STRUCTURES AND STRATEGIES FOR STATE SPACE SEARCH 3.0 Introduction 3.1 Graph Theory 3.2 Strategies for State Space Search 3.3 Using the State Space to Represent Reasoning with the Predicate

More information

Uninformed Search Methods. Informed Search Methods. Midterm Exam 3/13/18. Thursday, March 15, 7:30 9:30 p.m. room 125 Ag Hall

Uninformed Search Methods. Informed Search Methods. Midterm Exam 3/13/18. Thursday, March 15, 7:30 9:30 p.m. room 125 Ag Hall Midterm Exam Thursday, March 15, 7:30 9:30 p.m. room 125 Ag Hall Covers topics through Decision Trees and Random Forests (does not include constraint satisfaction) Closed book 8.5 x 11 sheet with notes

More information

7 Temporal Models (20 points)

7 Temporal Models (20 points) 7 Temporal Models (20 points) 1. For the Rain-Umbrella HMM model (from class and Figure 15.2 in AIMA) with 2 time periods, show how variable elimination operates to answer the following query P (R 1 U

More information

(Due to rounding, values below may be only approximate estimates.) We will supply these numbers as they become available.

(Due to rounding, values below may be only approximate estimates.) We will supply these numbers as they become available. Below, for each problem on this Midterm Exam, Perfect is the percentage of students who received full credit, Partial is the percentage who received partial credit, and Zero is the percentage who received

More information

Lecture 5 Heuristics. Last Time: A* Search

Lecture 5 Heuristics. Last Time: A* Search CSE 473 Lecture 5 Heuristics CSE AI Faculty Last Time: A* Search Use an evaluation function f(n) for node n. f(n) = estimated total cost of path thru n to goal f(n) = g(n) + h(n) g(n) = cost so far to

More information

CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2016

CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 2016 CS-171, Intro to A.I. Mid-term Exam Winter Quarter, 016 YOUR NAME: YOUR ID: ID TO RIGHT: ROW: SEAT: The exam will begin on the next page. Please, do not turn the page until told. When you are told to begin

More information

6.034 Quiz 1, Spring 2004 Solutions

6.034 Quiz 1, Spring 2004 Solutions 6.034 Quiz 1, Spring 2004 Solutions Open Book, Open Notes 1 Tree Search (12 points) Consider the tree shown below. The numbers on the arcs are the arc lengths. Assume that the nodes are expanded in alphabetical

More information

Chronological Backtracking Conflict Directed Backjumping Dynamic Backtracking Branching Strategies Branching Heuristics Heavy Tail Behavior

Chronological Backtracking Conflict Directed Backjumping Dynamic Backtracking Branching Strategies Branching Heuristics Heavy Tail Behavior PART III: Search Outline Depth-first Search Chronological Backtracking Conflict Directed Backjumping Dynamic Backtracking Branching Strategies Branching Heuristics Heavy Tail Behavior Best-First Search

More information

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs Computational Optimization ISE 407 Lecture 16 Dr. Ted Ralphs ISE 407 Lecture 16 1 References for Today s Lecture Required reading Sections 6.5-6.7 References CLRS Chapter 22 R. Sedgewick, Algorithms in

More information

Search : Lecture 2. September 9, 2003

Search : Lecture 2. September 9, 2003 Search 6.825: Lecture 2 September 9, 2003 1 Problem-Solving Problems When your environment can be effectively modeled as having discrete states and actions deterministic, known world dynamics known initial

More information

Artificial Intelligence

Artificial Intelligence Artificial Intelligence Exercises & Solutions Chapters -4: Search methods. Search Tree. Draw the complete search tree (starting from S and ending at G) of the graph below. The numbers beside the nodes

More information

Basic Search Algorithms

Basic Search Algorithms Basic Search Algorithms Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Abstract The complexities of various search algorithms are considered in terms of time, space, and cost

More information

Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon)

Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon) CS121 Introduction to Artificial Intelligence Winter 2011 Homework #6 (Constraint Satisfaction, Non-Deterministic Uncertainty and Adversarial Search) Out: 2/21/11 Due: 2/29/11 (at noon) How to complete

More information

4 Search Problem formulation (23 points)

4 Search Problem formulation (23 points) 4 Search Problem formulation (23 points) Consider a Mars rover that has to drive around the surface, collect rock samples, and return to the lander. We want to construct a plan for its exploration. It

More information

Chapter3. Problem-Solving Agents. Problem Solving Agents (cont.) Well-defined Problems and Solutions. Example Problems.

Chapter3. Problem-Solving Agents. Problem Solving Agents (cont.) Well-defined Problems and Solutions. Example Problems. Problem-Solving Agents Chapter3 Solving Problems by Searching Reflex agents cannot work well in those environments - state/action mapping too large - take too long to learn Problem-solving agent - is one

More information

1 Tree Search (12 points)

1 Tree Search (12 points) 1 Tree Search (12 points) Consider the tree shown below. The numbers on the arcs are the arc lengths. Assume that the nodes are expanded in alphabetical order when no other order is specified by the search,

More information

Blind (Uninformed) Search (Where we systematically explore alternatives)

Blind (Uninformed) Search (Where we systematically explore alternatives) Blind (Uninformed) Search (Where we systematically explore alternatives) R&N: Chap. 3, Sect. 3.3 5 Slides from Jean-Claude Latombe at Stanford University (used with permission) Simple Problem-Solving-Agent

More information

Branch & Bound (B&B) and Constraint Satisfaction Problems (CSPs)

Branch & Bound (B&B) and Constraint Satisfaction Problems (CSPs) Branch & Bound (B&B) and Constraint Satisfaction Problems (CSPs) Alan Mackworth UBC CS 322 CSP 1 January 25, 2013 P&M textbook 3.7.4 & 4.0-4.2 Lecture Overview Recap Branch & Bound Wrap up of search module

More information

Moving On. 10. Single-agent Search. Applications. Why Alpha-Beta First?

Moving On. 10. Single-agent Search. Applications. Why Alpha-Beta First? Moving On 10. Single-agent Search Jonathan Schaeffer jonathan@cs.ualberta.ca www.cs.ualberta.ca/~jonathan Two-player adversary search is nice, but not all interesting problems can be mapped to games Large

More information

Searching with Partial Information

Searching with Partial Information Searching with Partial Information Above we (unrealistically) assumed that the environment is fully observable and deterministic Moreover, we assumed that the agent knows what the effects of each action

More information

ARTIFICIAL INTELLIGENCE LECTURE 3. Ph. D. Lect. Horia Popa Andreescu rd year, semester 5

ARTIFICIAL INTELLIGENCE LECTURE 3. Ph. D. Lect. Horia Popa Andreescu rd year, semester 5 ARTIFICIAL INTELLIGENCE LECTURE 3 Ph. D. Lect. Horia Popa Andreescu 2012-2013 3 rd year, semester 5 The slides for this lecture are based (partially) on chapter 4 of the Stuart Russel Lecture Notes [R,

More information

Artificial Intelligence Uninformed search

Artificial Intelligence Uninformed search Artificial Intelligence Uninformed search A.I. Uninformed search 1 The symbols&search hypothesis for AI Problem-solving agents A kind of goal-based agent Problem types Single state (fully observable) Search

More information

N-Queens problem. Administrative. Local Search

N-Queens problem. Administrative. Local Search Local Search CS151 David Kauchak Fall 2010 http://www.youtube.com/watch?v=4pcl6-mjrnk Some material borrowed from: Sara Owsley Sood and others Administrative N-Queens problem Assign 1 grading Assign 2

More information

Scalable Algorithmic Techniques Decompositions & Mapping. Alexandre David

Scalable Algorithmic Techniques Decompositions & Mapping. Alexandre David Scalable Algorithmic Techniques Decompositions & Mapping Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Focus on data parallelism, scale with size. Task parallelism limited. Notion of scalability

More information

Review Adversarial (Game) Search ( ) Review Constraint Satisfaction ( ) Please review your quizzes and old CS-271 tests

Review Adversarial (Game) Search ( ) Review Constraint Satisfaction ( ) Please review your quizzes and old CS-271 tests Review Agents (2.1-2.3) Mid-term Review Chapters 2-6 Review State Space Search Problem Formulation (3.1, 3.3) Blind (Uninformed) Search (3.4) Heuristic Search (3.5) Local Search (4.1, 4.2) Review Adversarial

More information

Monotonicity. Admissible Search: That finds the shortest path to the Goal. Monotonicity: local admissibility is called MONOTONICITY

Monotonicity. Admissible Search: That finds the shortest path to the Goal. Monotonicity: local admissibility is called MONOTONICITY Monotonicity Admissible Search: That finds the shortest path to the Goal Monotonicity: local admissibility is called MONOTONICITY This property ensures consistently minimal path to each state they encounter

More information

A Survey of Parallel Search Algorithms Over Alpha-Beta Search Trees Using Symmetric Multiprocessor Machines

A Survey of Parallel Search Algorithms Over Alpha-Beta Search Trees Using Symmetric Multiprocessor Machines A Survey of Parallel Search Algorithms Over Alpha-Beta Search Trees Using Symmetric Multiprocessor Machines Masters Project James Swafford Fall 2008 Advisor: Dr. Ronnie Smith Table of Contents 1 Abstract...3

More information

6. Algorithm Design Techniques

6. Algorithm Design Techniques 6. Algorithm Design Techniques 6. Algorithm Design Techniques 6.1 Greedy algorithms 6.2 Divide and conquer 6.3 Dynamic Programming 6.4 Randomized Algorithms 6.5 Backtracking Algorithms Malek Mouhoub, CS340

More information

Lecture 14: General Problem-Solving Methods

Lecture 14: General Problem-Solving Methods Lecture 14: General Problem-Solving Methods Problem Solving Methods Greedy Method Divide-and-Conquer Backtracking Dynamic Programming Branch-and-Bound Greedy Method The greedy method consists of an iteration

More information

CSE 530A. B+ Trees. Washington University Fall 2013

CSE 530A. B+ Trees. Washington University Fall 2013 CSE 530A B+ Trees Washington University Fall 2013 B Trees A B tree is an ordered (non-binary) tree where the internal nodes can have a varying number of child nodes (within some range) B Trees When a key

More information

Trees. Eric McCreath

Trees. Eric McCreath Trees Eric McCreath 2 Overview In this lecture we will explore: general trees, binary trees, binary search trees, and AVL and B-Trees. 3 Trees Trees are recursive data structures. They are useful for:

More information

Two-player Games ZUI 2012/2013

Two-player Games ZUI 2012/2013 Two-player Games ZUI 2012/2013 Game-tree Search / Adversarial Search until now only the searching player acts in the environment there could be others: Nature stochastic environment (MDP, POMDP, ) other

More information

Branch and Bound. Live-node: A node that has not been expanded. It is similar to backtracking technique but uses BFS-like search.

Branch and Bound. Live-node: A node that has not been expanded. It is similar to backtracking technique but uses BFS-like search. Branch and Bound Definitions: Branch and Bound is a state space search method in which all the children of a node are generated before expanding any of its children. Live-node: A node that has not been

More information

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 23 January, 2018

DIT411/TIN175, Artificial Intelligence. Peter Ljunglöf. 23 January, 2018 DIT411/TIN175, Artificial Intelligence Chapters 3 4: More search algorithms CHAPTERS 3 4: MORE SEARCH ALGORITHMS DIT411/TIN175, Artificial Intelligence Peter Ljunglöf 23 January, 2018 1 TABLE OF CONTENTS

More information

Here is a recursive algorithm that solves this problem, given a pointer to the root of T : MaxWtSubtree [r]

Here is a recursive algorithm that solves this problem, given a pointer to the root of T : MaxWtSubtree [r] CSE 101 Final Exam Topics: Order, Recurrence Relations, Analyzing Programs, Divide-and-Conquer, Back-tracking, Dynamic Programming, Greedy Algorithms and Correctness Proofs, Data Structures (Heap, Binary

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2008S-19 B-Trees David Galles Department of Computer Science University of San Francisco 19-0: Indexing Operations: Add an element Remove an element Find an element,

More information

Problem solving as Search (summary)

Problem solving as Search (summary) Problem solving as Search (summary) References Russell and Norvig, Artificial Intelligence: A modern approach, 2nd ed. Prentice Hall, 2003 (chapter 3) Nilsson, Artificial intelligence: A New synthesis.

More information

Two-player Games ZUI 2016/2017

Two-player Games ZUI 2016/2017 Two-player Games ZUI 2016/2017 Branislav Bošanský bosansky@fel.cvut.cz Two Player Games Important test environment for AI algorithms Benchmark of AI Chinook (1994/96) world champion in checkers Deep Blue

More information

Potential Midterm Exam Questions

Potential Midterm Exam Questions Potential Midterm Exam Questions 1. What are the four ways in which AI is usually viewed? Which of the four is the preferred view of the authors of our textbook? 2. What does each of the lettered items

More information