#notes#cs471

Recap

  • When deciding which node to expand next, choose node n with minimum value of some evaluation function f(n)
  • Priority Queue ordered from low to high by f Example:
  • Breadth first search: Expand shallowest node first
    • f(n) = Depth(n)
  • Search algorithm uses domain specific hints about goals
  • Hints formulized from heuristic function h(n)
  • h(n) = estimated cost of cheapest path from n to a goal state.
  • Idea: Best first search that contains h(n)

Heuristic Function

  • Non-negative function that estimates how close a state is to a goal.
  • h(n) = 0 if n is a goal state.
  • Examples include Manhattan Distance, Euclidian Distance, etc. for path planning.
Optimality of A* Search Tree

  1. is less than
  2. expands before
  • All ancestors of A will expand before B
    • A expands before B
    • A* search is optimal

Consistency of Heuristics

Main Idea: estimated heuristic costs actual costs

  • Admissibility
    • Heuristic Cost actual cost to goal
    • actual cost from n to G
  • Consistency
    • heuristic ‘arc’ cost actual cost for each arc

Search and Models

  • Your search is only as good as your models.
  • So far we have considered search methods that:
    • Systematically explore full search space
    • Return path from start to goal
  • In many problems path is irrelevant; goal is all you care about
    • Ex. 8 queens problem
  • Sometimes the goal test itself is unclear.
    • Ex. optimization problem (you don’t know best value)
    • Travelling salesman.
  • Useful when path to goal state does not matter
  • Basic Idea:
    • Only keep single “current” state
    • Improve iteratively
    • Don’t save paths followed
  • Characteristics
    • Low memory req
    • Effective — can find solutions in large spaces

Eight Queens Problem

  • Place 8 queens on board such that none can attack one another
  • How to formulate search?
    • Incremental formulation
    • Complete-state formulation
  • Heuristic / Objective: Number of attacking queens
  • Consider state-space landscape where:
    • Location = state
    • Elevation = evaluation of state
  • Move towards direction of increasing ‘value’
function HillClimbing(problem) return a state that is a local maximum
 current <- initial_state
 repeat:
	 best_neighbor <- current
	 for state in Neighbors(current):
		 if state.value > best_neighbor.value:
			 best_neighbor <- state
	if best_neighbor > current.value:
		current <- best_neighbor
	else:
		return current
Challenges for hill-climbing
  • Local Maxima
    • No way to back track from a local maximum
  • Plateau
    • Can have difficult time finding a way off flat portion of state space
  • Ridges
    • Ridges produce series of local maximum that are difficult to navigate out of

Variants of local hill-climbing

  • Stochastic hill-climbing
    • Select randomly from all moves that improve the value of objective function.
  • Random-restart hill-climbing
    • Conduct series of hill-climbing searches from random positions
    • Very frequently used in AI
Simulated Annealing
  • Key Idea: mostly goes “uphill” but occasionally travels “downhill” to escape local optimum
    • Likelihood to go downhill is controlled by a “temperature schedule”
function SimulatedAnnealing (problem, schedule) return a solution state
current <- initial_state

from t = 1 to infinity:
	T <- schedule(t)
	if T = 0 then return current
	next <- a randomly selectd neighbor of current
	dE = next.value - current.value
	if dE > 0:
		current <- next
	else:
		current <- next with probability e^{dE/T}
  • Similar to hill-climbing but…
    • Keep track of k current states, rather than single
    • Select k best neighbors among of the k current states
  • Stochastic Beam Search - Successors at random weighted by value
Genetic Algorithm
  • Fitness Function
    • Ex. number of pairs of non-attacking queens

Applications

Bounding Box Prediction

Object Detection: Single Object Idea: Check all boxes, find the most “cat”

  • About H x W positions
  • ~H x W window sizes
Hill Climbing Search
  • How to represent state?
    • Bounding Box:
      • Top-left and bottom right corners
    • How to define neighborhood?
Example

Problem:

  • Place airport such that sum of squared straight-line distances from each city is minimized. Formulation:
  • Location of airport
  • Cost function
  • How to handle continuous state?
  • Discretize into intervals of (delta)
  • Local search with Empirical Gradient

Gradient Descent

  • Move in opposite direction of gradient (steepest slope) in this situation
How to choose step size?
  • Constant:
  • Diminishing: