ITCS 6150-8150 Fall 2011 Jing Xiao
Local Search Algorithms and Optimization Problems
Idea: start with a potential solution candidate or a
partial solution candidate, and make
modifications to improve its quality until
a solution is obtained.
Good for problems where goal state is the solution,
and path is irrelevant. E.g., n-queens, TSP
Example: n-queens problem
Constant space: only keep the “current” state.
Hill-climbing
Simulated annealing
Evolutionary computation
Hill-climbing
Always try to make changes that improve the
1
ITCS 6150-8150 Fall 2011 Jing Xiao
current state to a better state
A good heuristic function is important
Question: how to design the heuristic functions for
such problems (where the solution is the goal state)?
Example: N-queens
Heuristic function h(state): number of conflicts
A better state has smaller h value. h(goal-state)=0
--- min-conflict heuristic
Hill-climbing does state search in the direction to
minimize h.
Depending on initial state, Hill-climbing can get
stuck in local maxima (or minima if cost is measured)
2
ITCS 6150-8150 Fall 2011 Jing Xiao
Complete?
Optimal?
Simulated annealing, P125-126, Fig. 4.5:
Escape local maxima by allowing some “bad” moves
but gradually decrease their frequency
3
ITCS 6150-8150 Fall 2011 Jing Xiao
Complete?
Optimal?
• One can prove: If T decreases slowly enough,
then simulated annealing search will find a
global optimum with probability approaching 1
• Widely used in VLSI layout, airline scheduling,
etc
4
ITCS 6150-8150 Fall 2011 Jing Xiao
Evolutionary Computation (Genetic Algorithms).
Multi-thread search
Allow interactions of different threads
P117 (GA)
327|52411 247|48552 327|48552
5
ITCS 6150-8150 Fall 2011 Jing Xiao
II. Constraint Satisfaction Problems (CSP)
(Chapt. 5)
CSP: state is defined by variables Xi with values vi
from domain Di
Goal state is not known. Goal test is a set of
constraints Ci specifying allowable values for
subsets (or combinations) of variables.
A solution to a CSP is a set of values to the
variables that satisfy the constraints.
Some CSPs also require a solution to maximize
an objective function.
E.g., n-queens problem can be formulated as a CSP.
So is Traveling Salesman’s Problem.
More examples: Cryptarithmetic (P206-207)
two
+ two
----------------------
Four
Variables? Values? Constraints?
6
ITCS 6150-8150 Fall 2011 Jing Xiao
Map coloring (P203)
Variables WA, NT, Q, NSW, V, SA, T
Domains Di = {red,green,blue}
Constraints: adjacent regions must have different
colors
Real-world CSPs:
- Assignment problems (e.g., who teaches what
class)
- Time tabling problems (e.g., which class is
offered when and where)
- Scheduling (e.g., transportation, factory, etc)
7
ITCS 6150-8150 Fall 2011 Jing Xiao
Solving CSP by Search:
1. Problem incremental formulation :
Init state: all variables unassigned
Operators: assign a value to an unassigned variable
Goal test: all variables assigned, and no constraints
are violated.
State data structure:
- Unassigned – a list of unassigned variables
- Assigned – a list of variables with values
2. Uninformed CSP Search methods:
- DFS – the dumb approach (e.g., map-coloring)
Max. branching factor: b= i |Di|
- Backtracking search – improve DFS by
o At each level of the search tree, assign
values to the same variable. b= |Di|
o Make sure that each assignment will not
violate the constraints (i.e., discard the
invalid states)
8
ITCS 6150-8150 Fall 2011 Jing Xiao
Drawback: it follows certain fixed order to
assign values to variables. As the result, an
insolvability may only be detected at the very
end of all assignments.
- Forward checking – improve backtracking by
looking ahead to detect insolvability
o Delete from the domains of unassigned
variables all the values that conflict with the
assigned variables so far.
3. Useful Heuristics
- Which variable to choose:
1) Minimum remaining value (MRV) heuristic
(P216) – choose the variable with the fewest
legal values.
2) Degree heuristic, also called most constrained
variable heuristic (P216)
- Which value to assign:
Least-constraining value heuristic (P217)
4. Apply Local Search Algorithms to CSP
State: all variables are assigned.
The constraints may not be satisfied.
Operators: re-assign values to any conflicted variable
9
ITCS 6150-8150 Fall 2011 Jing Xiao
Variable value selection: based on heuristic function
Typical heuristic functions: as explained above in 3.
Also, Min-conflict heuristic (explained earlier)
E.g., 8-queens, P221, Fig. 6.9
10