Course Outline 4.2 Searching with Problem-specific Knowledge Presented by: Wing Hang Cheung Paul Anh Tri Huynh Mei-Ki Maggie Yang Lu Ye CPSC 533 January.

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Review: Search problem formulation
Informed Search Methods How can we improve searching strategy by using intelligence? Map example: Heuristic: Expand those nodes closest in “as the crow.
CSC 423 ARTIFICIAL INTELLIGENCE
Search Strategies CPS4801. Uninformed Search Strategies Uninformed search strategies use only the information available in the problem definition Breadth-first.
Problem Solving by Searching
CSC344: AI for Games Lecture 5 Advanced heuristic search Patrick Olivier
SE Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Review: Search problem formulation
Introduction to Artificial Intelligence A* Search Ruth Bergman Fall 2002.
Iterative improvement algorithms Prof. Tuomas Sandholm Carnegie Mellon University Computer Science Department.
Informed search algorithms
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2008.
Artificial Intelligence
Informed Search Methods Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 4 Spring 2005.
Cooperating Intelligent Systems Informed search Chapter 4, AIMA.
Introduction to Artificial Intelligence A* Search Ruth Bergman Fall 2004.
Informed Search CSE 473 University of Washington.
Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
Review Best-first search uses an evaluation function f(n) to select the next node for expansion. Greedy best-first search uses f(n) = h(n). Greedy best.
CSC344: AI for Games Lecture 4: Informed search
Informed search methods Tuomas Sandholm Computer Science Department Carnegie Mellon University Read Chapter 4 of Russell and Norvig.
CS 561, Session 6 1 Last time: Problem-Solving Problem solving: Goal formulation Problem formulation (states, operators) Search for solution Problem formulation:
Informed Search Next time: Search Application Reading: Machine Translation paper under Links Username and password will be mailed to class.
Review: Search problem formulation Initial state Actions Transition model Goal state (or goal test) Path cost What is the optimal solution? What is the.
Problem Solving and Search Andrea Danyluk September 11, 2013.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Informed Search Uninformed searches easy but very inefficient in most cases of huge search tree Informed searches uses problem-specific information to.
Informed Search Methods How can we make use of other knowledge about the problem to improve searching strategy? Map example: Heuristic: Expand those nodes.
Informed search algorithms
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics Memory Bounded A* Search.
Informed search algorithms
Informed search algorithms Chapter 4. Outline Best-first search Greedy best-first search A * search Heuristics.
CHAPTER 4: INFORMED SEARCH & EXPLORATION Prepared by: Ece UYKUR.
1 Shanghai Jiao Tong University Informed Search and Exploration.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed searching. Informed search Blind search algorithms do not consider any information about the states and the goals Often there is extra knowledge.
Informed Search Methods Heuristic = “to find”, “to discover” “Heuristic” has many meanings in general How to come up with mathematical proofs Opposite.
Informed Search Include specific knowledge to efficiently conduct the search and find the solution.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Iterative Improvement Algorithm 2012/03/20. Outline Local Search Algorithms Hill-Climbing Search Simulated Annealing Search Local Beam Search Genetic.
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.
Lecture 3: Uninformed Search
For Wednesday Read chapter 6, sections 1-3 Homework: –Chapter 4, exercise 1.
For Wednesday Read chapter 5, sections 1-4 Homework: –Chapter 3, exercise 23. Then do the exercise again, but use greedy heuristic search instead of A*
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
Artificial Intelligence for Games Informed Search (2) Patrick Olivier
Informed search methods Tuomas Sandholm Computer Science Department Carnegie Mellon University Read Section of Russell and Norvig.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
A General Introduction to Artificial Intelligence.
Feng Zhiyong Tianjin University Fall  Best-first search  Greedy best-first search  A * search  Heuristics  Local search algorithms  Hill-climbing.
Local Search Algorithms and Optimization Problems
G5AIAI Introduction to AI Graham Kendall Heuristic Searches.
Heuristic Search  Best First Search –A* –IDA* –Beam Search  Generate and Test  Local Searches –Hill Climbing  Simple Hill Climbing  Steepest Ascend.
CPSC 420 – Artificial Intelligence Texas A & M University Lecture 5 Lecturer: Laurie webster II, M.S.S.E., M.S.E.e., M.S.BME, Ph.D., P.E.
Informed Search. S B AD E C F G straight-line distances h(S-G)=10 h(A-G)=7 h(D-G)=1 h(F-G)=1 h(B-G)=10 h(E-G)=8 h(C-G)=20 The graph above.
ARTIFICIAL INTELLIGENCE Dr. Seemab Latif Lecture No. 4.
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.
Chapter 3.5 Heuristic Search. Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
Lecture 3: Uninformed Search
Informed Search Methods
For Monday Chapter 6 Homework: Chapter 3, exercise 7.
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.
Course Outline 4.2 Searching with Problem-specific Knowledge
Searching for Solutions
Informed search algorithms
More advanced aspects of search
Presentation transcript:

Course Outline 4.2 Searching with Problem-specific Knowledge Presented by: Wing Hang Cheung Paul Anh Tri Huynh Mei-Ki Maggie Yang Lu Ye CPSC 533 January 25, 2000

Chapter 4 - Informed Search Methods 4.1 Best-First Search 4.2 Heuristic Functions 4.3 Memory Bounded Search 4.4 Iterative Improvement Algorithms

4.1 Best First Search Is just a General Search minimum-cost nodes are expanded first we basically choose the node that appears to be best according to the evaluation function Two basic approaches: Expand the node closest to the goal Expand the node on the least-cost solution path

Function BEST-FIRST-SEARCH(problem, EVAL-FN) returns a solution sequence Inputs: problem, a problem Eval-Fn, an evaluation function Queueing-Fu  a function that orders nodes by EVAL-FN Return GENERAL-SEARCH(problem, Queueing-Fn) The Algorithm

Greedy Search “ … minimize estimated cost to reach a goal” a heuristic function calculates such cost estimates h(n) = estimated cost of the cheapest path from the state at node n to a goal state

Function GREEDY-SEARCH(problem) return a solution or failure return BEST-FIRST-SEARCH(problem, h) Required that h(n) = 0 if n = goal The Code

Straight-line distance The straight-line distance heuristic function is a for finding route-finding problem h SLD (n) = straight-line distance between n and the goal location

A B C D E F G HI A E B C h=253 h=329 h=374

A ECB A FG h=253 AEF Total distance = = 431 h = 366 h = 178 h = 193 h = 253 h = 178

A AF BCE G IE AEIF h = 253 h =366h=178h=193 h = 253h = 0h = 178 h = 0h = 253 Total distance = =431

Optimality A-E-F-I = 431 A-E-G-H-I = 418 vs A B C D E F G HI

Completeness Greedy Search is incomplete Worst-case time complexity O(b m ) Straight-line distance A B C D h(n) A D B C Target node Starting node

A* search f(n) = g(n) + h(n) h = heuristic function g = uniform-cost search A B C D E F G HI

“ Since g(n) gives the path from the start node to node n, and h(n) is the estimated cost of the cheapest path from n to the goal, we have… ” f(n) = estimated cost of the cheapest solution through n

A E C B f = =449 f = =447 f= =393 f(n) = g(n) + h(n) A ECB A FG f = = 393 f = = 366 f = = 646 f = =417 f = = 413

A AF BCE G HE f = = 393 f = =413 f = = 415 f = = 553 f = = 366

A AF BCE G HE f = = 393 f = =413 f = = 553 f = = 366 f = = 415 I f = = 418 f(n) = g(n) + h(n)

A-E-G-H-I = 418 Remember earlier G H I E A f = = 418

The Algorithm function A*-SEARCH(problem) returns a solution or failure return BEST-FIRST-SEARCH(problem,g+h)

Chapter 4 - Informed Search Methods 4.1 Best-First Search 4.2 Heuristic Functions 4.3 Memory Bounded Search 4.4 Iterative Improvement Algorithms

HEURISTIC FUNCTIONS

OBJECTIVE é calculates the cost estimates of an algorithm

IMPLEMENTATION é Greedy Search é A* Search é IDA*

EXAMPLES é straight-line distance to B é 8-puzzle

EFFECTS é Quality of a given heuristic l Determined by the effective branching factor b* l A b* close to 1 is ideal l N = 1 + b* + (b*) (b*) d N = # nodes d = solution depth

EXAMPLE é If A* finds a solution depth 5 using 52 nodes, then b* = 1.91 é Usual b* exhibited by a given heuristic is fairly constant over a large range of problem instances

... A well-designed heuristic should have a b* close to 1. … allowing fairly large problems to be solved

NUMERICAL EXAMPLE Fig. 4.8Comparison of the search costs and effective branching factors for the IDA and A* algorithms with h1, h2. Data are averaged over 100 instances of the 8- puzzle, for various solution lengths.

INVENTING HEURISTIC FUNCTIONS How ? Depends on the restrictions of a given problem A problem with lesser restrictions is known as a relaxed problem

INVENTING HEURISTIC FUNCTIONS Fig. 4.7 A typical instance of the 8-puzzle.

INVENTING HEURISTIC FUNCTIONS One problem … one often fails to get one “clearly best” heuristic Given h 1, h 2, h 3, …, h m ; none dominates any others. Which one to choose ? h(n) = max(h 1 (n), …,h m (n))

INVENTING HEURISTIC FUNCTIONS Another way: performing experiment randomly on a particular problem gather results decide base on the collected information

HEURISTICS FOR CONSTRAINT SATISFACTION PROBLEMS (CSPs) most-constrained-variable least-constraining-value

EXAMPLE Fig 4.9A map-coloring problem after the first two variables (A and B) have been selected. Which country should we color next? D F A B E C

Chapter 4 - Informed Search Methods 4.1 Best-First Search 4.2 Heuristic Functions 4.3 Memory Bounded Search 4.4 Iterative Improvement Algorithms

4.3 MEMORY BOUNDED SEARCH In this section, we investigate two algorithms that are designed to conserve memory

Memory Bounded Search 1. IDA* (Iterative Deepening A*) search - is a logical extension of ITERATIVE - DEEPENING SEARCH to use heuristic information 2. SMA* (Simplified Memory Bounded A*) search

Iterative Deepening search Iterative Deepening is a kind of uniformed search strategy combines the benefits of depth- first and breadth-first search advantage - it is optimal and complete like breadth first search - modest memory requirement like depth-first search

IDA* (Iterative Deepening A*) search turning A* search  IDA* search each iteration is a depth first search ~ use an f-cost limit rather than a depth limit space requirement ~ worse case : b f*/  b - branching factor f* - optimal solution  - smallest operator cost d - depth ~ most case : b d is a good estimate of the storage requirement time complexity -- IDA* does not need to insert and delete nodes on a priority queue, its overhead per node can be much less than that of A*

IDA* search First, each iteration expands all nodes inside the contour for the current f-cost peeping over to find out the next contour lines once the search inside a given contour has been complete a new iteration is started using a new f-cost for the next contour Contour

IDA* search Algorithm function IDA* (problem) returns a solution sequence inputs: problem, a problem local variables: f-limit, the current f-cost limit root, a node root <-MAKE-NODE(INITIAL-STATE[problem]) f-limit  f-COST (root) loop do solution,f-limit  DFS-CONTOUR(root,f-limit) if solution is non-null then return solution if f-limit =  then return failure; end function DFS -CONTOUR (node, f-limit) returns a solution sequence and a new f- COST limit inputs: node, a node f-limit, the current f-COST limit local variables: next-f, the f-COST limit for the next contour, initially  if f-COST [node] > f-limit then return null, f-COST [node] if GOAL-TEST [problem] (STATE[node]} then return node, f-limit for each node s in SUCCESSOR (node) do solution, new-f  DFS-CONTOUR (s, f-limit) if solution is non-null then return solution, f-limit next-f  MIN (next-f,new-f); end return null, next-f

MEMORY BOUNDED SEARCH 1. IDA* (Iterative Deepening A*) search 2. SMA* (Simplified Memory Bounded A*) search - is similar to A*, but restricts the queue size to fit into the available memory

SMA* (Simplified Memory Bounded A*) Search advantage to use more memory -- improve search efficiency Can make use of all available memory to carry out the search remember a node rather than to regenerate it when needed

SMA* search (cont.) SMA* has the following properties SMA* will utilize whatever memory is made available to it SMA* avoids repeated states as far as its memory allows SMA* is complete if the available memory is sufficient to store the shallowest solution path

SMA* search (cont.) SMA* properties cont. SMA* is optimal if enough memory is available to store the shallowest optimal solution path when enough memory is available for the entire search tree, the search is optimally efficient

Progress of the SMA* search A 12 A B 15 A G 13 (15) 13 H A G G 15 (15) 24 (infinite) 24 A B 15 A B 15 (24) 15 A B 20 (24) 20 (infinite) D 20 Aim: find the lowest -cost goal node with enough memory Max Nodes = 3 A - root node D,F,I,J - goal node A BG 15 DC EF HI JK A B G 13 (Infinite) I 24 C (Infinite) Label: current f-cost Memory is full update (A) f-cost for the min child expand G, drop the higher f-cost leaf (B) Memorize B memory is full H not a goal node, mark h to infinite Drop H and add I G memorize H update (G) f-cost for the min child update (A) f-cost I is goal node, but may not be the best solution the path through G is not so great so B is generate for the second time Drop G and add C A memorize G C is non-goal node C mark to infinite Drop C and add D B memorize C D is a goal node and it is lowest f-cost node then terminate How about J has a cost of 19 instead of 24 ???????? 13

SMA* search (cont.) Function SMA *(problem) returns a solution sequence inputs: problem, a problem local variables: Queue, a queue of nodes ordered by f-cost Queue  Make-Queue({MAKENODE(INITIALSTATE[problem])}) loop do if Queue is empty then return failure n  deepest least-f-cost node in Queue if GOAL-TEST(n) then return success s  NEXT-SUCCESSOR(n) if s is not a goal and is at maximum depth then f(s)   else f(s)  MAX(f(n), g(s)+h(s)) if all of n’s successors have been generated then update n’s f-cost and those of its ancestors if necessary if SUCCESSORS(n) all in memory then remove n from Queue if memory is full then delete shallowest, highest-f-cost node in Queue remove it from its parent’s successor list insert its parent on Queue if necessary insert s on Queue end

Chapter 4 - Informed Search Methods 4.1 Best-First Search 4.2 Heuristic Functions 4.3 Memory Bounded Search 4.4 Iterative Improvement Algorithms

ITERATIVE IMPROVEMENT ALGORITHMS For the most practical approach in which All the information needed for a solution are contained in the state description itself The path of reaching a solution is not important Advantage: memory save by keeping track of only the current state Two major classes: Hill-climbing (gradient descent)Hill-climbing (gradient descent) Simulated annealing

Hill-Climbing Search Only record the state and it evaluation instead of maintaining a search tree Function Hill-Climbing(problem) returns a solution state inputs: problem, a problem local variables: current, a node next, a mode current  Make-Node(Initial-State[problem]) loop do next  a highest-valued successor of current if Value[next]  Value[current] then return current current  next end

Hill-Climbing Search select at random when there is more than one best successor to choose from Three well-known drawbacks: Local maxima Plateaux Ridges When no progress can be made, start from a new point.start from a new point

Local Maxima A peak lower than the highest peak in the state space The algorithm halts when a local maximum is reached

Plateaux Neighbors of the state are about the same height A random walk will be generated

Ridges No steep sloping sides between the top and peaks The search makes little progress unless the top is directly reached

Random-Restart Hill-Climbing Generates different starting points when no progress can be made from the previous point Saves the best result Can eventually find out the optimal solution if enough iterations are allowed The fewer local maxima, the quicker it finds a good solution

Simulated Annealing Picks random moves Keeps executing the move if the situation is actually improved; otherwise, makes the move of a probability less than 1 Number of cycles in the search is determined according to probability The search behaves like hill-climbing when approaching the end Originally used for the process of cooling a liquidthe process of cooling a liquid

Simulated-Annealing Function Function Simulated-Annealing(problem, schedule) returns a solution state inputs: problem, a problem schedule, a mapping from time to “temperature” local variables: current, a node next, a node T, a “temperature” controlling the probability of downward steps current  Make-Node(Initial-State[problem]) for t  1 to  do T  schedule[t] if T=0 then return current next  a randomly selected successor of current  E  Value[next] - Value[current] if  E  0 then current  next else current  next only with probability e  E/T

Applications in Constraint Satisfaction Problems General algorithms for Constraint Satisfaction Problems assigns values to all variables applies modifications to the current configuration by assigning different values to variables towards a solution Example problem: an 8-queens probleman 8-queens problem (Definition of an 8-queens problem is on Pg64, text)

An 8-queens Problem Algorithm chosen: the min-conflicts heuristic repair method Algorithm Characteristics: repairs inconsistencies in the current configuration selects a new value for a variable that results in the minimum number of conflicts with other variables

Detailed Steps 1. One by one, find out the number of conflicts between the inconsistent variable and other variables.

Detailed Steps 2. Choose the one with the smallest number of conflicts to make a move

Detailed Steps 3. Repeat previous steps until all the inconsistent variables have been assigned with a proper value.