Backtracking And Branch And Bound

Slides:



Advertisements
Similar presentations
Review: Search problem formulation
Advertisements

Uninformed search strategies
State Space Heuristic Search. Three Algorithms  Backtrack  Depth First  Breadth First All work if we have well-defined:  Goal state  Start state.
State Space 3 Chapter 4 Heuristic Search. Three Algorithms Backtrack Depth First Breadth First All work if we have well-defined: Goal state Start state.
Problem Solving Agents A problem solving agent is one which decides what actions and states to consider in completing a goal Examples: Finding the shortest.
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.
Implementation and Evaluation of Search Methods. Use a stack data structure. 1. Push root node of tree on the stack. 2. Pop the top node off the stack.
Artificial Intelligence (CS 461D)
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
Search in AI.
Backtracking.
Review: Search problem formulation
Toy Problem: Missionaries and Cannibals
UnInformed Search What to do when you don’t know anything.
1 Solving Problems by Searching. 2 Terminology State State Space Initial State Goal Test Action Step Cost Path Cost State Change Function State-Space.
Blind Search-Part 2 Ref: Chapter 2. Search Trees The search for a solution can be described by a tree - each node represents one state. The path from.
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.
Solving Problems by Searching
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
1 Problem Solving and Searching CS 171/271 (Chapter 3) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Solving Problems by Searching CPS Outline Problem-solving agents Example problems Basic search algorithms.
Search.
1 Solving problems by searching Chapter 3. Depth First Search Expand deepest unexpanded node The root is examined first; then the left child of the root;
Basic Problem Solving Search strategy  Problem can be solved by searching for a solution. An attempt is to transform initial state of a problem into some.
Ch22.Branch and Bound.
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.
Lecture 3 Problem Solving through search Uninformed Search
Chapter 6 Branch & Bound (B & B).
Lecture 3: Uninformed Search
Hard Problems Some problems are hard to solve.
Integer Programming An integer linear program (ILP) is defined exactly as a linear program except that values of variables in a feasible solution have.
Breadth First and Depth First
Backtracking And Branch And Bound
COMP 103 Tree Traversals Lindsay Groves 2016-T2 Lecture 22
Uninformed Search Chapter 3.4.
i206: Lecture 13: Recursion, continued Trees
Binary Tree and General Tree
(edited by Nadia Al-Ghreimil)
Artificial Intelligence (CS 370D)
Backtracking And Branch And Bound
Artificial Intelligence Problem solving by searching CSC 361
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Analysis and design of algorithm
Exact Solutions to NP-Complete Problems
HW #1 Due 29/9/2008 Write Java Applet to solve Goats and Cabbage “Missionaries and cannibals” problem with the following search algorithms: Breadth first.
Back Tracking.
Lecture 1B: Search.
SOLVING PROBLEMS BY SEARCHING
Problem Solving and Searching
Tree Representation Heap.
What to do when you don’t know anything know nothing
EA C461 – Artificial Intelligence
Searching for Solutions
Analysis & Design of Algorithms (CSCE 321)
B-Trees This presentation shows you the potential problem of unbalanced tree and show one way to fix it This lecture introduces heaps, which are used.
Chapter 11 Graphs.
Problem Solving and Searching
Principles of Computing – UFCFA3-30-1
Problem Spaces & Search
Branch and Bound Searching Strategies
CSE 473 University of Washington
UNINFORMED SEARCH -BFS -DFS -DFIS - Bidirectional
B-Trees This presentation shows you the potential problem of unbalanced tree and show one way to fix it This lecture introduces heaps, which are used.
CS 416 Artificial Intelligence
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Tree Searching Strategies
Solving Problems by Searching
Lecture 4: Tree Search Strategies
Solving Problems by Searching
Presentation transcript:

Backtracking And Branch And Bound

Subset & Permutation Problems Subset problem of size n. Nonsystematic search of the space for the answer takes O(p2n) time, where p is the time needed to evaluate each member of the solution space. Permutation problem of size n. Nonsystematic search of the space for the answer takes O(pn!) time, where p is the time needed to evaluate each member of the solution space. Backtracking and branch and bound perform a systematic search; often taking much less time than taken by a nonsystematic search.

Tree Organization Of Solution Space Set up a tree structure such that the leaves represent members of the solution space. For a size n subset problem, this tree structure has 2n leaves. For a size n permutation problem, this tree structure has n! leaves. The tree structure is too big to store in memory; it also takes too much time to create the tree structure. Portions of the tree structure are created by the backtracking and branch and bound algorithms as needed. Tree organizations in which nonleaf nodes represent members of the solution space are also possible.

Subset Tree For n = 4 x1= 0 x1=1 x2= 0 x2=1 x2=1 x2= 0 x3=1 x3= 0 x4=1 0001 0111 1110 1011

Permutation Tree For n = 3 x1= 3 x1=1 x1=2 x2= 2 x2= 3 x2= 1 x2= 3 x2= 1 x2= 2 x3=3 x3=2 x3=3 x3=1 x3=2 x3=1 123 132 213 231 312 321

Backtracking Search the solution space tree in a depth-first manner. May be done recursively or use a stack to retain the path from the root to the current node in the tree. The solution space tree exists only in your mind, not in the computer.

Backtracking Depth-First Search x1= 0 x1=1 x2= 0 x2=1 x2=1 x2= 0

Backtracking Depth-First Search x1= 0 x1=1 x2= 0 x2=1 x2=1 x2= 0

Backtracking Depth-First Search x1= 0 x1=1 x2= 0 x2=1 x2=1 x2= 0

Backtracking Depth-First Search x1= 0 x1=1 x2= 0 x2=1 x2=1 x2= 0

Backtracking Depth-First Search x1= 0 x1=1 x2= 0 x2=1 x2=1 x2= 0

O(2n) Subet Sum & Bounding Functions x1=1 x1= 0 x2=1 x2= 0 When you move forward on an x =1 branch, add to a variable that keeps track of the sum of the subset represented by the node. When you move back on an x = 1 branch, subtract. Moving in either direction along an x = 0 branch requires no add/subtract. When you reach a node with the desired sum, terminate. When you reach a node whose sum exceeds the desired sum, backtrack; do not move into this nodes subtrees. When you make a right child move see if the desired sum is attainable by adding in all remaining integers; for this keep another variable that gives you the sum of the remaining integers. Each forward and backward move takes O(1) time.

Backtracking Space required is O(tree height). With effective bounding functions, large instances can often be solved. For some problems (e.g., 0/1 knapsack), the answer (or a very good solution) may be found quickly but a lot of additional time is needed to complete the search of the tree. Run backtracking for as much time as is feasible and use best solution found up to that time.

Branch And Bound Search the tree using a breadth-first search (FIFO branch and bound). Search the tree as in a bfs, but replace the FIFO queue with a stack (LIFO branch and bound). Replace the FIFO queue with a priority queue (least-cost (or max priority) branch and bound). The priority of a node p in the queue is based on an estimate of the likelihood that the answer node is in the subtree whose root is p.

Branch And Bound Space required is O(number of leaves). For some problems, solutions are at different levels of the tree (e.g., 16 puzzle). 1 3 2 4 5 6 13 14 15 12 11 10 9 7 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Branch And Bound FIFO branch and bound finds solution closest to root. Backtracking may never find a solution because tree depth is infinite (unless repeating configurations are eliminated). Least-cost branch and bound directs the search to parts of the space most likely to contain the answer. So it could perform better than backtracking.