Problem Solving Agents Using Improved Heuristics as
Informed Search
Dr. A.F.M. Saifuddin Saif
Senior Assistant Professor Department of Computer Science American International University – Bangladesh Email: saif@aiub.edu Description of the tasks Find out tiles sequence where interchange of subsequent tiles will be done from each sequence.- The process is known as Reversals In the random sequence, find out the sum of distance for misplaced tiles comparing with goal state. Find out level cost , g (n). Consider least cost evaluation function to go for the next state. f(n)=g(n) +h(n)
Dr. A. F. M. Saifuddin Saif 2
Dr. A. F. M. Saifuddin Saif 3 Dr. A. F. M. Saifuddin Saif 4 Dr. A. F. M. Saifuddin Saif 5 Dr. A. F. M. Saifuddin Saif 6 Dr. A. F. M. Saifuddin Saif 7 Activities Uninformed solution (Solution without intelligence) Generate random sequences of tiles Apply better heuristics strategies using f(n)=g(n) + h(n)
Dr. A. F. M. Saifuddin Saif 8
Implementation Instructions √ Any programming language based on your preference
9 Dr. A. F. M. Saifuddin Saif Other tasks
Space complexity
Time complexity
Cost (No of States / No of Steps/ No of
Level)
Dr. A. F. M. Saifuddin Saif 10
Pseudocode (1) • class State • 2D_Puzzle_Board • blankTilesX • blankTilesY • misplacedTiles • level • cost • end class • • classPriorityQueue • States [a container] • function push (State state) • insert state and sort by ascending order of cost • function front () • return first state of the container • function pop () • remove first state from the container • function empty () • return true if size of the container is 0 • function size () • return size of the container • end class
Dr. A. F. M. Saifuddin Saif 11
Pseudocode (2) • functionsolvePuzzle (initialState) • initializePriorityQueue queue • insertinitialState to queue • while queue not empty • pop x from queue • insert x to visited • if x equal goalState • print solution • return • end if • for top, bottom, left, right • create possible state • if (state not visited) • calculate level, no of misplaced tiles • calculate cost = level + no of misplaced tiles • insert into queue • end for • end while • end function