When A* doesn’t work CIS 391 – Intro to Artificial Intelligence A few slides adapted from CS 471, Fall 2004, UBMC (which were adapted from notes by Charles.

Slides:



Advertisements
Similar presentations
Informed search algorithms
Advertisements

Local Search and Optimization
Local Search Algorithms
CSC344: AI for Games Lecture 5 Advanced heuristic search Patrick Olivier
Local search algorithms
Local search algorithms
Two types of search problems
Iterative improvement algorithms Prof. Tuomas Sandholm Carnegie Mellon University Computer Science Department.
CS 4700: Foundations of Artificial Intelligence
Adapted by Doug Downey from Bryan Pardo Fall 2007 Machine Learning EECS 349 Machine Learning Lecture 4: Greedy Local Search (Hill Climbing)
Introduction to Artificial Intelligence Heuristic Search Ruth Bergman Fall 2002.
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.
PROBLEM SOLVING BY SEARCHING (2)
Informed Search Chapter 4 Adapted from materials by Tim Finin, Marie desJardins, and Charles R. Dyer CS 63.
Beyond Classical Search (Local Search) R&N III: Chapter 4
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 5 Jim Martin.
Informed Search Next time: Search Application Reading: Machine Translation paper under Links Username and password will be mailed to class.
1 CS 2710, ISSP 2610 R&N Chapter 4.1 Local Search and Optimization.
Local Search and Optimization
Informed Search Chapter 4 (b)
1 Local search and optimization Local search= use single current state and move to neighboring states. Advantages: –Use very little memory –Find often.
When A* fails – Hill climbing, simulated annealing Genetic algorithms
Search CSE When you can’t use A* Hill-climbing Simulated Annealing Other strategies 2 person- games.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
An Introduction to Artificial Life Lecture 4b: Informed Search and Exploration Ramin Halavati In which we see how information.
Local Search Algorithms This lecture topic Chapter Next lecture topic Chapter 5 (Please read lecture topic material before and after each lecture.
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.
Chapter 4.1 Beyond “Classic” Search. What were the pieces necessary for “classic” search.
Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability"  Expand most.
1 CS 2710, ISSP 2610 Chapter 4, Part 2 Heuristic Search.
Iterative Improvement Algorithm 2012/03/20. Outline Local Search Algorithms Hill-Climbing Search Simulated Annealing Search Local Beam Search Genetic.
Local Search Algorithms
Local Search Pat Riddle 2012 Semester 2 Patricia J Riddle Adapted from slides by Stuart Russell,
Princess Nora University Artificial Intelligence Chapter (4) Informed search algorithms 1.
Local Search and Optimization Presented by Collin Kanaley.
4/11/2005EE562 EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS Lecture 4, 4/11/2005 University of Washington, Department of Electrical Engineering Spring 2005.
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.
Informed search algorithms Chapter 4 Slides derived in part from converted to powerpoint by Min-Yen.
Announcement "A note taker is being recruited for this class. No extra time outside of class is required. If you take clear, well-organized notes, this.
Chapter 4 (Section 4.3, …) 2 nd Edition or Chapter 4 (3 rd Edition) Local Search and Optimization.
Lecture 6 – Local Search Dr. Muhammad Adnan Hashmi 1 24 February 2016.
Local Search Algorithms and Optimization Problems
CPSC 322, Lecture 16Slide 1 Stochastic Local Search Variants Computer Science cpsc322, Lecture 16 (Textbook Chpt 4.8) Oct, 11, 2013.
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.
Local Search and Optimization Chapter 4 Mausam (Based on slides of Padhraic Smyth, Stuart Russell, Rao Kambhampati, Raj Rao, Dan Weld…) 1.
Local Search Algorithms CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and.
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"
1 Intro to AI Local Search. 2 Intro to AI Local search and optimization Local search: –use single current state & move to neighboring states Idea: –start.
Informed Search Chapter 4 (b)
Informed Search Chapter 4 (b)
Department of Computer Science
Informed Search Chapter 4 (b)
Local Search Algorithms
Artificial Intelligence (CS 370D)
Local Search and Optimization
CSE 4705 Artificial Intelligence
Informed Search Chapter 4 (b)
Artificial Intelligence
Local Search Algorithms
CSC 380: Design and Analysis of Algorithms
Beyond Classical Search
Local Search Algorithms
Presentation transcript:

When A* doesn’t work CIS 391 – Intro to Artificial Intelligence A few slides adapted from CS 471, Fall 2004, UBMC (which were adapted from notes by Charles R. Dyer, University of Wisconsin-Madison)

CIS Intro to AI 2 Outline  Local Search: Hill Climbing  Escaping Local Maxima: Simulated Annealing  Genetic Algorithms (if time allows)

CIS Intro to AI 3 Local search and optimization  Local search: Use single current state and move to neighboring states.  Idea: start with an initial guess at a solution and incrementally improve it until it is one  Advantages: Use very little memory Find often reasonable solutions in large or infinite state spaces.  Also useful for pure optimization problems. Find best state according to some objective function. e.g. survival of the fittest as a metaphor for optimization.

Hill Climbing

CIS Intro to AI 5 Hill climbing on a surface of states Height Defined by Evaluation Function

CIS Intro to AI 6 Hill-climbing search: Take I & II I.While (  uphill points): Move in the direction of increasing value, lessening distance to goal II.If (  a successor s i for the current state n such that —h(s i ) < h(n) —h(s i )  h(s j ) for all successors s j of n, j  i,): then move from n to s i. Otherwise, halt at n.  Properties: Terminates when a peak is reached. Does not look ahead of the immediate neighbors of the current state. Chooses randomly among the set of best successors, if there is more than one. Doesn’t backtrack, since it doesn’t remember where it’s been  a.k.a. greedy local search "Like climbing Everest in thick fog with amnesia"

CIS Intro to AI 7 Hill-climbing search: Take III function HILL-CLIMBING( problem) return a state that is a local maximum input: problem, a problem local variables: current, a node. neighbor, a node. current  MAKE-NODE(INITIAL-STATE[problem]) loop do neighbor  a highest valued successor of current if VALUE [neighbor] ≤ VALUE[current] then return STATE[current] current  neighbor

CIS Intro to AI 8 Hill climbing Example I start goal 5 h = 4 h = 3 h = 2 h = 1 h = 0 h = h(n) = (number of tiles out of place)

CIS Intro to AI 9 Hill-climbing Example: n-queens  Put n queens on an n × n board with no two queens on the same row, column, or diagonal

CIS Intro to AI 10 Hill-climbing example: 8-queens h = number of pairs of queens that are attacking each other a) A state with h=17 and the h-value for each possible successor. b) A local minimum of h in the 8-queens state space (h=1). a) b)

CIS Intro to AI 11 Search Space features

CIS Intro to AI 12 Drawbacks of hill climbing  Problems: Local Maxima (foothills): peaks that aren’t the highest point in the space Plateaus: the space has a broad flat region that gives the search algorithm no direction (random walk) Ridges: flat like a plateau, but with dropoffs to the sides; steps to the North, East, South and West may go down, but a step to the NW may go up.

CIS Intro to AI 13 Example of a local maximum startgoal

CIS Intro to AI 14 The Shape of an Easy Problem

CIS Intro to AI 15 The Shape of a Harder Problem

CIS Intro to AI 16 The Shape of a Yet Harder Problem

CIS Intro to AI 17 Remedies to drawbacks of hill climbing  Random restart  Problem reformulation  In the end: Some problem spaces are great for hill climbing and others are terrible.

Simulated Annealing

CIS Intro to AI 19 Simulated annealing (SA)  Annealing: the process by which a metal cools and freezes into a minimum-energy crystalline structure (the annealing process)  SA exploits an analogy between annealing and the search for a minimum [or maximum] in a more general system.

CIS Intro to AI 20 Simulated annealing  Idea: Escape local maxima by allowing “bad” moves. But gradually decrease their size and frequency.  Bouncing ball analogy: Shaking hard (= high temperature). Shaking less (= lower the temperature).  Control parameter T By analogy with the original application is known as the system “temperature.” T starts out high and gradually decreases toward 0. If T decreases slowly enough, then finds a global optimum with probability approaching 1.  Applied for VLSI layout, airline scheduling, etc.

CIS Intro to AI 21 The Simulated Annealing Algorithm function SIMULATED-ANNEALING( problem, schedule) return a solution state input: 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

CIS Intro to AI 22 Local beam search  Keep track of k states instead of one Initially: k random states Next: determine all successors of k states If any of successors is goal  finished Else select k best from successors and repeat.  Major difference with random-restart search Information is shared among k search threads.  Can suffer from lack of diversity. Stochastic variant: choose k successors at proportionally to state success.

Genetic Algorithms (only if time allows)

CIS Intro to AI 24 Genetic algorithms  Start with k random states (the initial population)  New states are generated by either 1.“Mutation” of a single state or 2.“Sexual Reproduction” (combining) of two parent states (selected according to their fitness)  Encoding used for the “genome” of an individual strongly affects the behavior of the search  Similar (in some ways) to stochastic beam search

CIS Intro to AI 25 Representation: Strings of genes  Each chromosome represents a possible solution made up of a string of genes  Each gene encodes some property of the solution  There is a fitness metric on phenotypes of chromosomes Evaluation of how well a solution with that set of properties solves the problem.  New generations are formed by Crossover: sexual reproduction Mutation: asexual reproduction

CIS Intro to AI 26 Encoding of a Chromosome  The chromosome encodes characteristics of the solution which it represents, often as a string of binary digits. Chromosome Chromosome  Each bit or set of bits in this string represents some aspect of the solution.

CIS Intro to AI 27 Example: Genetic Algorithm for Drive Train Genes for:  Number of Cylinders  RPM: 1 st -> 2 nd  RPM 2 nd -> 3 rd  RPM 3 rd -> Drive  Rear end gear ratio  Size of wheels A Chromosome specifies a full drive train design

CIS Intro to AI 28 Reproduction  Reproduction by crossover selects genes from two parent chromosomes and creates two new offspring.  To do this, randomly choose some crossover point (perhaps none).  For the first child, everything before this point comes from the first parent and everything after a from the second parent.  Crossover can then look like this ( | is the crossover point): Chromosome | Chromosome | Offspring | Offspring |

CIS Intro to AI 29 Mutation  Mutation randomly changes genes in the new offspring.  For binary encoding we can switch a few randomly chosen bits from 1 to 0 or from 0 to 1. Original offspring Mutated offspring

CIS Intro to AI 30 The Basic Genetic Algorithm 1.Generate random population of chromosomes 2.Until the end condition is met, create a new population by repeating following steps 1.Evaluate the fitness of each chromosome 2.Select two parent chromosomes from a population, weighed by their fitness 3.With probability p c cross over the parents to form a new offspring. 4.With probability p m mutate new offspring at each position on the chromosome. 5.Place new offspring in the new population 3.Return the best solution in current population

CIS Intro to AI 31 Genetic algorithm function GENETIC_ALGORITHM( population, FITNESS-FN) return an individual input: population, a set of individuals FITNESS-FN, a function which determines the quality of the individual repeat new_population  empty set loop for i from 1 to SIZE(population) do x  RANDOM_SELECTION(population, FITNESS_FN) y  RANDOM_SELECTION(population, FITNESS_FN) child  REPRODUCE(x,y) if (small random probability) then child  MUTATE(child ) add child to new_population population  new_population until some individual is fit enough or enough time has elapsed return the best individual

CIS Intro to AI 32 Genetic algorithms:8-queens