Finding Optimal Solution of 15 puzzle B94902062 NTUCSIE Kai-Yung Chiang.

Slides:



Advertisements
Similar presentations
BEST FIRST SEARCH - BeFS
Advertisements

Informed search algorithms
Introduction to Algorithms 6.046J/18.401J
Chapter 4: Informed Heuristic Search
Heuristics, and what to do if you dont know what to do Carl Hultquist.
Heuristic Search The search techniques we have seen so far...
Lights Out Issues Questions? Comment from me.
Informed Search CS 171/271 (Chapter 4)
Heuristic Functions By Peter Lane
Informed search algorithms
Review: Search problem formulation
Heuristic Search. Best First Search A* Heuristic Search Heuristic search exploits additional knowledge about the problem that helps direct search to.
Informed Search Algorithms
Heuristic Search Ref: Chapter 4.
11 Data Structures Foundations of Computer Science ã Cengage Learning.
Microsoft Confidential. We look at the world... with our own eyes...
Lecture 4: Informed/Heuristic Search
Informed search strategies
Informed search algorithms
AI Pathfinding Representing the Search Space
An Introduction to Artificial Intelligence
Artificial Intelligence
The A* Algorithm Héctor Muñoz-Avila. The Search Problem Starting from a node n find the shortest path to a goal node g ?
A* Search. 2 Tree search algorithms Basic idea: Exploration of state space by generating successors of already-explored states (a.k.a.~expanding states).
Problem Solving: Informed Search Algorithms Edmondo Trentin, DIISM.
PRACTICAL IMPROVEMENT: A-STAR, KD-TREE, FIBONACCI HEAP CS16: Introduction to Data Structures & Algorithms Thursday, April 10,
How to create Magic Squares
Greedy best-first search Use the heuristic function to rank the nodes Search strategy –Expand node with lowest h-value Greedily trying to find the least-cost.
Informed search algorithms
Heuristics Some further elaborations of the art of heuristics and examples.
Solving Problem by Searching
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.
Solving Problems by Searching Currently at Chapter 3 in the book Will finish today/Monday, Chapter 4 next.
Chapter 6: Transform and Conquer
Review: Search problem formulation
Informed Search (no corresponding text chapter). Recall: Wanted " An algorithm and associated data structure(s) that can: 1) Solve an arbitrary 8-puzzle.
MAE 552 – Heuristic Optimization Lecture 27 April 3, 2002
Problem Solving and Search in AI Heuristic Search
Dovetail Killer? Implementing Jonathan’s New Idea Tarek Sherif.
Informed Search Idea: be smart about what paths to try.
Graphs II Robin Burke GAM 376. Admin Skip the Lua topic.
Vilalta&Eick: Informed Search Informed Search and Exploration Search Strategies Heuristic Functions Local Search Algorithms Vilalta&Eick: Informed Search.
P ROBLEM Write an algorithm that calculates the most efficient route between two points as quickly as possible.
Informed search algorithms
Li Wang Haorui Wu University of South Carolina 04/02/2015 A* with Pattern Databases.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
Informed search strategies Idea: give the algorithm “hints” about the desirability of different states – Use an evaluation function to rank nodes and select.
Informed Search Strategies Lecture # 8 & 9. Outline 2 Best-first search Greedy best-first search A * search Heuristics.
For Friday Finish reading chapter 4 Homework: –Lisp handout 4.
For Monday Read chapter 4, section 1 No homework..
Review: Tree search Initialize the frontier using the starting state While the frontier is not empty – Choose a frontier node to expand according to search.
Neural Heuristics For Problem Solving: Using ANNs to Develop Heuristics for the 8-Puzzle by Bambridge E. Peterson.
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*
Informed Search and Heuristics Chapter 3.5~7. Outline Best-first search Greedy best-first search A * search Heuristics.
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.
Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most desirable unexpanded node Implementation:
Heuristic Functions. A Heuristic is a function that, when applied to a state, returns a number that is an estimate of the merit of the state, with respect.
Search Techniques CS480/580 Fall Introduction Trees: – Root, parent, child, sibling, leaf node, node, edge – Single path from root to any node Graphs:
A* optimality proof, cycle checking CPSC 322 – Search 5 Textbook § 3.6 and January 21, 2011 Taught by Mike Chiang.
Chapter 3.5 and 3.6 Heuristic Search Continued. Review:Learning Objectives Heuristic search strategies –Best-first search –A* algorithm Heuristic functions.
For Monday Read chapter 4 exercise 1 No homework.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Discussion on Greedy Search and A*
Discussion on Greedy Search and A*
Heuristics Local Search
Heuristics Local Search
Informed Search Idea: be smart about what paths to try.
Informed Search Idea: be smart about what paths to try.
Presentation transcript:

Finding Optimal Solution of 15 puzzle B NTUCSIE Kai-Yung Chiang

15 puzzle introduction Initial states: a solvable puzzle, including numbered 1~15 tiles and a blank tile 0 Goal state: puzzle in which tiles 0 ~ 15 are in well permutation from row to column A (valid) move: swap blank tile with its neighboring tile The optimal solution: given a initial state, find the move sequence such that it is a solution taking the fewest moves to reach the goal state

Searching Algorithm A* search Each node has heuristic (the estimating distance from current state to goal state) Each node s evaluation function = heuristic + total moves from initial state A* always expands the fringe node whose evaluation function is minimum

Example h=45, f=45 : expanded nodes h: heuristic f: evaluation function: fringe nodes

Example h=45, f=45 h=41, f=42h=45, f=46h=42, f=43 : expanded nodes h: heuristic f: evaluation function: fringe nodes

Example h=45, f=45 h=41, f=42h=45, f=46h=42, f=43 h=45, f=47h=42, f=44h=43, f=45 : expanded nodes h: heuristic f: evaluation function: fringe nodes

Example h=45, f=45 h=41, f=42h=45, f=46h=42, f=43 h=45, f=47h=42, f=44h=43, f=45 h=45, f=47h=39, f=41h=40, f=42 : expanded nodes h: heuristic f: evaluation function: fringe nodes

Pros: Can find the optimal solution (or admissible) if heuristic function will never overestimate Eliminate number of expanded nodes Cons: Taking more time on expanding each nodes (compared with DFS or BFS): Find minimum nodes (in fringe) to expand Compute heuristic and evaluation function Check, eliminate and update repetitive states Maintain data structure Pros and cons for A* search

Speed up by good data structure Priority queue: Fibonacci heap Extract minimum and decrease key in (amortized) O(logn) Insert in O(1) Hash function: Used in checking repetitive states, eliminate number of searching nodes A* search with above data structure and Manhattan distance as heuristic function could solve 8 puzzle in (averaged) seconds However, still too slow to solve 15 puzzle

Still too many nodes need to be expanded (though eliminate repetitive states) If f(n) = 2h(n) + moves(n) … Could speed up much, but not admissible. Ideas: try to improve h(n) to be more close to truly needed optimal moves, while still maintaining admissible Disjoint pattern database heuristic instead of Manhattan distance New heuristic = i number of needed moves to well order tiles in pattern i More speed up technique

Pattern database Divide puzzle into 3 disjoint patterns Each pattern has 16!/10! 5.7 * 10 6 different combination orders of tiles, and each of them corresponds to a database entry Each entry records moves for aligning these pattern tiles to correct position

Building pattern database Constructed by bottom up approach Start with well ordered tiles BFS moving blank tile to new states, move is added only when tile in this pattern is swapped with blank tile Add new entry to pattern database if current state has not been traversed (using a bits of array to record this information)

Benchmark and outcome Randomly generate 100 solvable puzzles:

Benchmark and outcome Pattern database heuristic improves nearly 10 moves than Manhattan distance in averaged In most problem instances … Expanded nodes are less than 100,000 Could be solved in 30 seconds, and more than half could be solved in 10 seconds CPU% are less than 20%. It might suggest that lots of time are took in communication with database Pattern database heuristic improves a lot

Demo