Module 2. Problem Solving using Search- (Single agent search) Version 1 CSE IIT, Kharagpur

Similar documents
Smart Graphics: Methoden 3 Suche, Constraints

AI: A Modern Approach, Chpts. 3-4 Russell and Norvig

Measuring the Performance of an Agent

CS MidTerm Exam 4/1/2004 Name: KEY. Page Max Score Total 139

Guessing Game: NP-Complete?

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

Example Problems. Channel Routing. Lots of Chip Real-estate. Same connectivity, much less space. Slide 1. Slide 2

Binary Search Trees CMPSC 122

Lecture. Simulation and optimization

Kenken For Teachers. Tom Davis June 27, Abstract

Nurse Rostering. Jonathan Johannsen CS 537. Scheduling Algorithms

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

Informed search algorithms. Chapter 4, Sections 1 2 1

Chapter 13: Binary and Mixed-Integer Programming

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

CMPSCI611: Approximating MAX-CUT Lecture 20

Analysis of Algorithms I: Binary Search Trees

Search methods motivation 1

From Last Time: Remove (Delete) Operation

5.1 Bipartite Matching

Load Balancing. Load Balancing 1 / 24

Y. Xiang, Constraint Satisfaction Problems

A Non-Linear Schema Theorem for Genetic Algorithms

Near Optimal Solutions

A Systematic Approach to Model-Guided Empirical Search for Memory Hierarchy Optimization

Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

Complete Solution of the Eight-Puzzle and the Benefit of Node Ordering in IDA*

3 Some Integer Functions

Introduction Solvability Rules Computer Solution Implementation. Connect Four. March 9, Connect Four

Problem Set 7 Solutions

Genetic Algorithms and Sudoku

Special Situations in the Simplex Algorithm

Approximation Algorithms

CSE 4351/5351 Notes 7: Task Scheduling & Load Balancing

Temporal Difference Learning in the Tetris Game

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

R-trees. R-Trees: A Dynamic Index Structure For Spatial Searching. R-Tree. Invariants

Introduction to Logic in Computer Science: Autumn 2006

Linear Programming. March 14, 2014

Introduction To Genetic Algorithms

Ant Colony Optimization (ACO)

International Journal of Advanced Research in Computer Science and Software Engineering

Inteligencia Artificial Representación del conocimiento a través de restricciones (continuación)

Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Course: Model, Learning, and Inference: Lecture 5

Algorithms Chapter 12 Binary Search Trees

Ordered Lists and Binary Trees

PARALLELIZED SUDOKU SOLVING ALGORITHM USING OpenMP

Complexity Classes P and NP

A Software Architecture for a Photonic Network Planning Tool

Evaluation of Different Task Scheduling Policies in Multi-Core Systems with Reconfigurable Hardware

ECON 459 Game Theory. Lecture Notes Auctions. Luca Anderlini Spring 2015

Symbol Tables. Introduction

Heaps & Priority Queues in the C++ STL 2-3 Trees

Memory Allocation Technique for Segregated Free List Based on Genetic Algorithm

Dynamic Programming. Lecture Overview Introduction

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

- Easy to insert & delete in O(1) time - Don t need to estimate total memory needed. - Hard to search in less than O(n) time

Binary Heap Algorithms

Binary Heaps. CSE 373 Data Structures

The Problem of Scheduling Technicians and Interventions in a Telecommunications Company

Data Structure with C

D A T A M I N I N G C L A S S I F I C A T I O N

Lecture 3. Linear Programming. 3B1B Optimization Michaelmas 2015 A. Zisserman. Extreme solutions. Simplex method. Interior point method

The PageRank Citation Ranking: Bring Order to the Web

Name Partners Date. Energy Diagrams I

Arrangements And Duality

Lecture 10: Regression Trees

Applied Algorithm Design Lecture 5

STUDY OF PROJECT SCHEDULING AND RESOURCE ALLOCATION USING ANT COLONY OPTIMIZATION 1

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Genetic programming with regular expressions

TEACHER NOTES MATH NSPIRED

Algorithms and Data Structures

Introduction to MATLAB IAP 2008

Clustering & Visualization

Offline sorting buffers on Line

Learning Example. Machine learning and our focus. Another Example. An example: data (loan application) The data and the goal

APP INVENTOR. Test Review

Meta-Heuristics for Reconstructing Cross Cut Shredded Text Documents

The Effects of Start Prices on the Performance of the Certainty Equivalent Pricing Policy

CSE 326: Data Structures B-Trees and B+ Trees

Design and Analysis of ACO algorithms for edge matching problems

Big Data and Scripting. Part 4: Memory Hierarchies

A binary heap is a complete binary tree, where each node has a higher priority than its children. This is called heap-order property

Efficient Crawling of Community Structures in Online Social Networks

Lecture 1: Course overview, circuits, and formulas

7.S.8 Interpret data to provide the basis for predictions and to establish

Game playing. Chapter 6. Chapter 6 1

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Methods for Solving Sudoku Puzzles

Random Map Generator v1.0 User s Guide

Laboratory work in AI: First steps in Poker Playing Agents and Opponent Modeling

SUDOKUBE USING GENETIC ALGORITHMS TO SIMULTANEOUSLY SOLVE MULTIPLE COMBINATORIAL PROBLEMS DAVID ISAAC WATERS. B.S. Electrical Engineering

Unique column combinations

Transcription:

Module 2 Problem Solving using Search- (Single agent search)

Lesson 6 Informed Search Strategies-II

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 bound modified to be an f-limit 1. Start with limit = h(start) 2. Prune any node if f(node) > f-limit 3. Next f-limit=minimum cost of any node pruned The cut-off for nodes expanded in an iteration is decided by the f-value of the nodes. a e f d b Figure 1 c Consider the graph in Figure 3. In the first iteration, only node a is expanded. When a is expanded b and e are generated. The f value of both are found to be 15. For the next iteration, a f-limit of 15 is selected, and in this iteration, a, b and c are expanded. This is illustrated in Figure 4. a e f d b c Figure 2: f-limit = 15

a e f d b c Figure 3: f-limit = 21 3.3.2 IDA* Analysis IDA* is complete & optimal Space usage is linear in the depth of solution. Each iteration is depth first search, and thus it does not require a priority queue. The number of nodes expanded relative to A* depends on # unique values of heuristic function. The number of iterations is equal tit h number of distinct f values less than or equal to C*. In problems like 8 puzzle using the Manhattan distance heuristic, there are few possible f values (f values are only integral in this case.). Therefore the number of node expansions in this case is close to the number of nodes A* expands. But in problems like traveling salesman (TSP) using real valued costs, : each f value may be unique, and many more nodes may need to be expanded. In the worst case, if all f values are distinct, the algorithm will expand only one new node per iteration, and thus if A* expands N nodes, the maximum number of nodes expanded by IDA* is 1+2+ + N = O(N2) Why do we use IDA*? In the case of A*, it I usually the case that for slightly larger problems, the algorithm runs out of main memory much earlier than the algorithm runs out of time. IDA* can be used in such cases as the space requirement is linear. In fact 15- puzzle problems can be easily solved by IDA*, and may run out of space on A*. IDA* is not thus suitable for TSP type of problems. Also IDA* generates duplicate nodes in cyclic graphs. Depth first search strategies are not very suitable for graphs containing too many cycles.

Space required : O(bd) IDA* is complete, optimal, and optimally efficient (assuming a consistent, admissible heuristic), and requires only a polynomial amount of storage in the worst case: 3.4 Other Memory limited heuristic search IDA* uses very little memory Other algorithms may use more memory for more efficient search. 3.4.1 RBFS: Recursive Breadth First Search RBFS uses only linear space. It mimics best first search. It keeps track of the f-value of the best alternative path available from any ancestor of the current node. If the current node exceeds this limit, the alternative path is explored. RBFS remembers the f-value of the best leaf in the forgotten sub-tree.

RBFS (node: N, value: F(N), bound: B) IF f(n)>b, RETURN f(n) IF N is a goal, EXIT algorithm IF N has no children, RETURN infinity FOR each child Ni of N, IF f(n)<f(n), F[i] := MAX(F(N),f(Ni)) ELSE F[i] := f(ni) sort Ni and F[i] in increasing order of F[i] IF only one child, F[2] := infinity WHILE (F[1] <= B and F[1] < infinity) F[1] := RBFS(N1, F[1], MIN(B, F[2])) insert Ni and F[1] in sorted order RETURN F[1] 3.4.2 MA* and SMA* MA* and SMA* are restricted memory best first search algorithms that utilize all the memory available. The algorithm executes best first search while memory is available. When the memory is full the worst node is dropped but the value of the forgotten node is backed up at the parent. 3.5 Local Search Local search methods work on complete state formulations. They keep only a small number of nodes in memory. Local search is useful for solving optimization problems: o Often it is easy to find a solution o But hard to find the best solution Algorithm goal: find optimal configuration (e.g., TSP), Hill climbing Gradient descent Simulated annealing For some problems the state description contains all of the information relevant for a solution. Path to the solution is unimportant. Examples: o map coloring o 8-queens o cryptarithmetic

Start with a state configuration that violates some of the constraints for being a solution, and make gradual modifications to eliminate the violations. One way to visualize iterative improvement algorithms is to imagine every possible state laid out on a landscape with the height of each state corresponding to its goodness. Optimal solutions will appear as the highest points. Iterative improvement works by moving around on the landscape seeking out the peaks by looking only at the local vicinity. 3.5.1 Iterative improvement In many optimization problems, the path is irrelevant; the goal state itself is the solution. An example of such problem is to find configurations satisfying constraints (e.g., n- queens). Algorithm: Start with a solution Improve it towards a good solution

3.5.1.1 Example: N queens Goal: Put n chess-game queens on an n x n board, with no two queens on the same row, column, or diagonal. Example: Chess board reconfigurations Here, goal state is initially unknown but is specified by constraints that it must satisfy Hill climbing (or gradient ascent/descent) Iteratively maximize value of current state, by replacing it by successor state that has highest value, as long as possible. Note: minimizing a value function v(n) is equivalent to maximizing v(n), thus both notions are used interchangeably. Hill climbing example Complete state formulation for 8 queens Successor function: move a single queen to another square in the same column Cost: number of pairs that are attacking each other. Minimization problem Hill climbing (or gradient ascent/descent) Iteratively maximize value of current state, by replacing it by successor state that has highest value, as long as possible. Note: minimizing a value function v(n) is equivalent to maximizing v(n), thus both notions are used interchangeably. Algorithm: 1. determine successors of current state 2. choose successor of maximum goodness (break ties randomly) 3. if goodness of best successor is less than current state's goodness, stop 4. otherwise make best successor the current state and go to step 1 No search tree is maintained, only the current state. Like greedy search, but only states directly reachable from the current state are considered. Problems:

Local maxima Once the top of a hill is reached the algorithm will halt since every possible step leads down. Plateaux If the landscape is flat, meaning many states have the same goodness, algorithm degenerates to a random walk. Ridges If the landscape contains ridges, local improvements may follow a zigzag path up the ridge, slowing down the search. Shape of state space landscape strongly influences the success of the search process. A very spiky surface which is flat in between the spikes will be very difficult to solve. Can be combined with nondeterministic search to recover from local maxima. Random-restart hill-climbing is a variant in which reaching a local maximum causes the current state to be saved and the search restarted from a random point. After several restarts, return the best state found. With enough restarts, this method will find the optimal solution. Gradient descent is an inverted version of hill-climbing in which better states are represented by lower cost values. Local minima cause problems instead of local maxima. Hill climbing - example Complete state formulation for 8 queens Successor function: move a single queen to another square in the same column Cost: number of pairs that are attacking each other. Minimization problem Problem: depending on initial state, may get stuck in local extremum. Global maximum value Local maximum states

Minimizing energy Compare our state space to that of a physical system that is subject to natural interactions Compare our value function to the overall potential energy E of the system. On every updating, we have DE 0 Basin of D A Attraction for C B E C Hence the dynamics of the system tend to move E toward a minimum. We stress that there may be different such states they are local minima. Global minimization is not guaranteed. Question: How do you avoid this local minima? starting point barrier to local search descend direction local minima global minima Consequences of Occasional Ascents Simulated annealing: basic idea From current state, pick a random successor state; If it has better value than current state, then accept the transition, that is, use successor state as current state;

Simulated annealing: basic idea Otherwise, do not give up, but instead flip a coin and accept the transition with a given probability (that is lower as the successor is worse). So we accept to sometimes un-optimize the value function a little with a non-zero probability. Instead of restarting from a random point, we can allow the search to take some downhill steps to try to escape local maxima. Probability of downward steps is controlled by temperature parameter. High temperature implies high chance of trying locally "bad" moves, allowing nondeterministic exploration. Low temperature makes search more deterministic (like hill-climbing). Temperature begins high and gradually decreases according to a predetermined annealing schedule. Initially we are willing to try out lots of possible paths, but over time we gradually settle in on the most promising path. If temperature is lowered slowly enough, an optimal solution will be found. In practice, this schedule is often too slow and we have to accept suboptimal solutions. Algorithm: set current to start state for time = 1 to infinity { set Temperature to annealing_schedule[time] if Temperature = 0 { return current } randomly pick a next state from successors of current set ΔE to value(next) - value(current) if ΔE > 0 { set current to next } else { set current to next with probability e ΔE/Temperature } } Probability of moving downhill for negative ΔE values at different temperature ranges:

Other local search methods Genetic Algorithms Questions for Lecture 6 1. Compare IDA* with A* in terms of time and space complexity. 2. Is hill climbing guaranteed to find a solution to the n-queens problem? 3. Is simulated annealing guaranteed to find the optimum solution of an optimization problem like TSP? 1. Suppose you have the following search space: State next cost A B 4 A C 1 B D 3 B E 8 C C 0 C D 2 C F 6 D C 2 D E 4 E G 2 F G 8

a. Draw the state space of this problem. b. Assume that the initial state is A and the goal state is G. Show how each of the following search strategies would create a search tree to find a path from the initial state to the goal state: i. Uniform cost search ii. Greedy search iii. A* search At each step of the search algorithm, show which node is being expanded, and the content of fringe. Also report the eventual solution found by each algorithm, and the solution cost.