230 likes | 462 Views
Informed Search. Informed vs. Uninformed. Uninformed Search: just takes the information available in the problem description Informed Search: Takes additional problem specific properties to guide the search A way of “engineering knowledge” into the search. Best First Search.
E N D
Informed vs. Uninformed • Uninformed Search: just takes the information available in the problem description • Informed Search: Takes additional problem specific properties to guide the search • A way of “engineering knowledge” into the search
Best First Search • A general search strategy • Uses an evaluation function f() in deciding which node (in queue) to expand next • Note: “best” could be misleading (it is relative, not absolute) • Greedy search is one type of Best First Search • What’s another you have seen?
Greedy Search • Use a heuristic h() (cost estimate to goal) as the evaluation function • Example: straight-line distance in finding a path from one city to another • It is not optimal or complete • O(b^m) time and memory • But can be acceptable in practice
Minimizing Total Path Cost • Use for the evaluation: f(node) = g(node) + h(node) where, f is the evaluation function, g is the path from root, and h is the heuristic (estimate to goal) • Or, f() = estimate of cheapest path to goal • Without h(), the search would be? • Without g()? • Combine advantages of both…
A* search • We can actually guarantee optimality. by using an admissible heuristic: • h() is admissible if it never overestimates the cost to reach the goal • Example: straight-line distance in the travel problem
Why is A* Optimal? • First we assume f() never decreases along a path (simple modification to the definition f() allows this) • Let f* be shortest path length, then • A* expands all nodes with f(node) < f* • Then some nodes with f(node)=f* before discovering the goal • Optimality follows • (need to assume some finiteness)
Other Properties • It is complete if finitely many nodes n, with f(n) <= f* (e.g. finite branch factor and minimum positive distance) • No more expansion than other path following search optimal methods • Number of nodes can still be exponential within the goal counter (f < f*) • Memory is specially a problem (motivates IDA* and SMA*)
Heuristics • Heuristics can make a big difference • Example: for the 8-puzzle problem • h1: Incorrect position count • h2: Manhatten distance • Observation: One dominates the other • Often: the higher the value (the under-estimate) the better • How about the cost to evaluate h()?
The Art (and Science) of Heuristic Design • Relax the (constraints of the) problem • (so solution costs become under-estimates) • E.g. 8-puzzle, Rubic’s cube • Pick out state features that are significant for winning • E.g. chess, go • Other ideas: • Use max of multiple admissible heuristics • Use statistical heuristics or other (may give up optimality)
When only the goal matters • In many optimization problems, the path is irrelevant • The “goal” state is the solution (the state is described by a set of conditions/constraints, not given) • Examples: • n-queens • traveling salesperson (TSP), • constraint satisfaction problems (CSPs) in general
Local Search • Take the current state and “locally” change it until you reach a state that satisfies certain conditions • It may stop at the goal state/configuration or an optimum state • Examples: • Hill-climbing (gradient ascent/descent) • Simulated Annealing
TSP: Find the shortest path that visits all the cities once
Choice of neighborhood • In search algorithms, there is usually choices of state and operators • In local search: the choice of operators (“actions”) defines a neighborhood and can make a big difference • And don’t forget the choice of heuristic
Hill-Climbing • Among the successors of the state, pick one that improves the most • Can get stuck in local optima, plateaus, or ridges global local value states
Repeated Hill-Climbing • To avoid local optima and other problems, and improve the overall solution found, repeatedly restart the hill-climbing: random restarts • The success of hill-climbing depends on the shape of the space “surface”
Simulated Annealing • Instead of restarting, take a random, possibly (locally) bad move • Helps get over local optimal • A parameter T, “temperature,” determines the probability of choosing a random (not necessarily best) move • Higher T, more random moves • In annealing, T is lowered gradually (use a “schedule”)
Constraint Satisfaction Problems • Problem: a number of variable with a number of possible values for each • Constraints on the possible variable values • Goal state: All constraints are satisfied • Example: n-queens, satisfiability, VLSI
Heuristics for CSPs and Search • Variables are incrementally assigned values • To limit the branching factor and/or depth searched, use: • Most constrained-variable heuristic • Most-constraining-variable heuristic • Least-constraining-value heuristic
Heuristics for CSPs with Local Search • Min conflicts: Choose the new variable value resulting in minimum number of with other variables (unsatisfied constraints) • N-queens: put the queen in the spot resulting in the minimum number of threats to it
Summary • Informed search more powerful than uninformed • Two main search techniques of “systematic” search and local-search • There is an art to choice of space, operators (actions), and heuristics • These choices can make a huge difference