Recall: breadth-first search, step by step

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Solving problems by searching Chapter 3. Outline Problem-solving agents Problem types Problem formulation Example problems Basic search algorithms.
Additional Topics ARTIFICIAL INTELLIGENCE
Informed search algorithms
Local Search Algorithms
Informed search algorithms
Laurent Itti: CS564 - Brain Theory and Artificial Intelligence
UNINFORMED SEARCH Problem - solving agents Example : Romania  On holiday in Romania ; currently in Arad.  Flight leaves tomorrow from Bucharest.
CSC344: AI for Games Lecture 5 Advanced heuristic search Patrick Olivier
Local search algorithms
Local search algorithms
Two types of search problems
CS 561, Session 7 1 Recall: breadth-first search, step by step.
1 Chapter 5 Advanced Search. 2 Chapter 5 Contents l Constraint satisfaction problems l Heuristic repair l The eight queens problem l Combinatorial optimization.
Trading optimality for speed…
Problem Solving and Search in AI Heuristic Search
CSC344: AI for Games Lecture 4: Informed search
CS 561, Session 7 1 Recall: breadth-first search, step by step.
1 DCP 1172 Introduction to Artificial Intelligence Lecture notes for Chap. 4 [AIMA] Chang-Sheng Chen.
1 Local search and optimization Local search= use single current state and move to neighboring states. Advantages: –Use very little memory –Find often.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Informed search algorithms
Informed search algorithms
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.
Iterative Improvement Algorithm 2012/03/20. Outline Local Search Algorithms Hill-Climbing Search Simulated Annealing Search Local Beam Search Genetic.
Local Search Algorithms
1 Informed search algorithms Chapter 4. 2 Outline Best-first search Greedy best-first search A * search Heuristics Local search algorithms Hill-climbing.
Local Search Pat Riddle 2012 Semester 2 Patricia J Riddle Adapted from slides by Stuart Russell,
Simulated Annealing. Difficulty in Searching Global Optima starting point descend direction local minima global minima barrier to local search.
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
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 In many optimization problems, the state space is the space of all possible complete solutions We have an objective function that.
Lecture 6 – Local Search Dr. Muhammad Adnan Hashmi 1 24 February 2016.
Local Search Algorithms and Optimization Problems
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.
Constraints Satisfaction Edmondo Trentin, DIISM. Constraint Satisfaction Problems: Local Search In many optimization problems, the path to the goal is.
Local search algorithms In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution State space = set of "complete"
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.
CSCI 4310 Lecture 10: Local Search Algorithms
Department of Computer Science
Last time: search strategies
Last time: Problem-Solving
Artificial Intelligence (CS 370D)
Local Search Algorithms
Problem Solving by Searching
Artificial Intelligence (CS 370D)
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.
Artificial Intelligence
Solving problems by searching
Heuristic search INT 404.
Searching for Solutions
Informed search algorithms
More on Search: A* and Optimization
G5BAIM Artificial Intelligence Methods
Xin-She Yang, Nature-Inspired Optimization Algorithms, Elsevier, 2014
Artificial Intelligence
Lecture 9 Administration Heuristic search, continued
More on HW 2 (due Jan 26) Again, it must be in Python 2.7.
More on HW 2 (due Jan 26) Again, it must be in Python 2.7.
Local Search Algorithms
Heuristic Search Generate and Test Hill Climbing Best First Search
CMSC 471 Fall 2011 Class #4 Tue 9/13/11 Uninformed Search
Local Search Algorithms
Simulated Annealing & Boltzmann Machines
Presentation transcript:

Recall: breadth-first search, step by step CS 561, Session 6

Implementation of search algorithms Function General-Search(problem, Queuing-Fn) returns a solution, or failure nodes  make-queue(make-node(initial-state[problem])) loop do if nodes is empty then return failure node  Remove-Front(nodes) if Goal-Test[problem] applied to State(node) succeeds then return node nodes  Queuing-Fn(nodes, Expand(node, Operators[problem])) end Queuing-Fn(queue, elements) is a queuing function that inserts a set of elements into the queue and determines the order of node expansion. Varieties of the queuing function produce varieties of the search algorithm. CS 561, Session 6

Recall: breath-first search, step by step CS 561, Session 6

Breadth-first search Node queue: initialization # state depth path cost parent # 1 Arad 0 0 -- CS 561, Session 6

Breadth-first search Node queue: add successors to queue end; empty queue from top # state depth path cost parent # 1 Arad 0 0 -- 2 Zerind 1 1 1 3 Sibiu 1 1 1 4 Timisoara 1 1 1 CS 561, Session 6

Breadth-first search Node queue: add successors to queue end; empty queue from top # state depth path cost parent # 1 Arad 0 0 -- 2 Zerind 1 1 1 3 Sibiu 1 1 1 4 Timisoara 1 1 1 5 Arad 2 2 2 6 Oradea 2 2 2 (get smart: e.g., avoid repeated states like node #5) CS 561, Session 6

Depth-first search CS 561, Session 6

Depth-first search Node queue: initialization # state depth path cost parent # 1 Arad 0 0 -- CS 561, Session 6

Depth-first search Node queue: add successors to queue front; empty queue from top # state depth path cost parent # 2 Zerind 1 1 1 3 Sibiu 1 1 1 4 Timisoara 1 1 1 1 Arad 0 0 -- CS 561, Session 6

Depth-first search Node queue: add successors to queue front; empty queue from top # state depth path cost parent # 5 Arad 2 2 2 6 Oradea 2 2 2 2 Zerind 1 1 1 3 Sibiu 1 1 1 4 Timisoara 1 1 1 1 Arad 0 0 -- CS 561, Session 6

Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited Iterative deepening Informed: Use heuristics to guide the search Best first: Greedy search A* search CS 561, Session 6

Last time: search strategies Uninformed: Use only information available in the problem formulation Breadth-first Uniform-cost Depth-first Depth-limited Iterative deepening Informed: Use heuristics to guide the search Best first: Greedy search -- queue first nodes that maximize heuristic “desirability” based on estimated path cost from current node to goal; A* search – queue first nodes that minimize sum of path cost so far and estimated path cost to goal. CS 561, Session 6

This time Iterative improvement Hill climbing Simulated annealing CS 561, Session 6

Iterative improvement In many optimization problems, path is irrelevant; the goal state itself is the solution. Then, state space = space of “complete” configurations. Algorithm goal: - find optimal configuration (e.g., TSP), or, - find configuration satisfying constraints (e.g., n-queens) In such cases, can use iterative improvement algorithms: keep a single “current” state, and try to improve it. CS 561, Session 6

Iterative improvement example: vacuum world Simplified world: 2 locations, each may or not contain dirt, each may or not contain vacuuming agent. Goal of agent: clean up the dirt. If path does not matter, do not need to keep track of it. CS 561, Session 6

Iterative improvement 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. Here, goal state is initially unknown but is specified by constraints that it must satisfy. CS 561, Session 6

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. CS 561, Session 6

Question: What is the difference between this problem and our problem (finding global minima)? CS 561, Session 6

thus both notions are used interchangeably. Hill climbing Note: minimizing a “value” function v(n) is equivalent to maximizing –v(n), thus both notions are used interchangeably. Notion of “extremization”: find extrema (minima or maxima) of a value function. CS 561, Session 6

Problem: depending on initial state, may get stuck in local extremum. Hill climbing Problem: depending on initial state, may get stuck in local extremum. CS 561, Session 6

Minimizing energy Let’s now change the formulation of the problem a bit, so that we can employ new formalism: - let’s compare our state space to that of a physical system that is subject to natural interactions, - and let’s compare our value function to the overall potential energy E of the system. On every updating, we have DE  0 CS 561, Session 6

Hence the dynamics of the system tend to move E toward a minimum. Minimizing energy 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. CS 561, Session 6

Local Minima Problem Question: How do you avoid this local minimum? barrier to local search starting point descend direction local minimum global minimum CS 561, Session 6

The Boltzmann Machine of Hinton, Sejnowski, and Ackley (1984) Boltzmann machines h The Boltzmann Machine of Hinton, Sejnowski, and Ackley (1984) uses simulated annealing to escape local minima. To motivate their solution, consider how one might get a ball- bearing traveling along the curve to "probably end up" in the deepest minimum. The idea is to shake the box "about h hard" — then the ball is more likely to go from D to C than from C to D. So, on average, the ball should end up in C's valley. CS 561, Session 6

Consequences of the Occasional Ascents desired effect Help escaping the local optima. adverse effect (easy to avoid by keeping track of best-ever state) Might pass global optima after reaching it CS 561, Session 6

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; 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. CS 561, Session 6

Boltzmann’s statistical theory of gases In the statistical theory of gases, the gas is described not by a deterministic dynamics, but rather by the probability that it will be in different states. The 19th century physicist Ludwig Boltzmann developed a theory that included a probability distribution of temperature (i.e., every small region of the gas had the same kinetic energy). Hinton, Sejnowski and Ackley’s idea was that this distribution might also be used to describe neural interactions, where low temperature T is replaced by a small noise term T (the neural analog of random thermal motion of molecules). While their results primarily concern optimization using neural networks, the idea is more general. CS 561, Session 6

Boltzmann distribution At thermal equilibrium at temperature T, the Boltzmann distribution gives the relative probability that the system will occupy state A vs. state B as: where E(A) and E(B) are the energies associated with states A and B. CS 561, Session 6

Simulated annealing Kirkpatrick et al. 1983: Simulated annealing is a general method for making likely the escape from local minima by allowing jumps to higher energy states. The analogy here is with the process of annealing used by a craftsman in forging a sword from an alloy. He heats the metal, then slowly cools it as he hammers the blade into shape. If he cools the blade too quickly the metal will form patches of different composition; If the metal is cooled slowly while it is shaped, the constituent metals will form a uniform alloy. CS 561, Session 6

Simulated annealing in practice set T optimize for given T lower T repeat CS 561, Session 6 MDSA: Molecular Dynamics Simulated Annealing

Simulated annealing in practice set T optimize for given T lower T (see Geman & Geman, 1984) repeat Geman & Geman (1984): if T is lowered sufficiently slowly (with respect to the number of iterations used to optimize at a given T), simulated annealing is guaranteed to find the global minimum. Caveat: this algorithm has no end (Geman & Geman’s T decrease schedule is in the 1/log of the number of iterations, so, T will never reach zero), so it may take an infinite amount of time for it to find the global minimum. CS 561, Session 6

Simulated annealing algorithm Idea: Escape local extrema by allowing “bad moves,” but gradually decrease their size and frequency. Note: goal here is to maximize E. - CS 561, Session 6

Simulated annealing algorithm Idea: Escape local extrema by allowing “bad moves,” but gradually decrease their size and frequency. Algorithm when goal is to minimize E. - < - CS 561, Session 6

Note on simulated annealing: limit cases Boltzmann distribution: accept “bad move” with E<0 (goal is to maximize E) with probability P(E) = exp(E/T) If T is large: E < 0 E/T < 0 and very small exp(E/T) close to 1 accept bad move with high probability If T is near 0: E < 0 E/T < 0 and very large exp(E/T) close to 0 accept bad move with low probability CS 561, Session 6

Note on simulated annealing: limit cases Boltzmann distribution: accept “bad move” with E<0 (goal is to maximize E) with probability P(E) = exp(E/T) If T is large: E < 0 E/T < 0 and very small exp(E/T) close to 1 accept bad move with high probability If T is near 0: E < 0 E/T < 0 and very large exp(E/T) close to 0 accept bad move with low probability Random walk Deterministic down-hill CS 561, Session 6

Summary Best-first search = general search, where the minimum-cost nodes (according to some measure) are expanded first. Greedy search = best-first with the estimated cost to reach the goal as a heuristic measure. - Generally faster than uninformed search - not optimal - not complete. A* search = best-first with measure = path cost so far + estimated path cost to goal. - combines advantages of uniform-cost and greedy searches - complete, optimal and optimally efficient - space complexity still exponential CS 561, Session 6

Summary Time complexity of heuristic algorithms depend on quality of heuristic function. Good heuristics can sometimes be constructed by examining the problem definition or by generalizing from experience with the problem class. Iterative improvement algorithms keep only a single state in memory. Can get stuck in local extrema; simulated annealing provides a way to escape local extrema, and is complete and optimal given a slow enough cooling schedule. CS 561, Session 6