The Search Space
The Search Space
The Search Space
Q
The satisfiability problem:Given a Boolean equation, doe there exist a Boolean
argument that satisfies it?
For an equation of 3 variables (X1,X2,X3), the solution space is as in Fig.6-1.
Q←{root}
While Q≠Φ do
{
P←Remove(Q);
If P = goal stop;
D←descendent(P);
For each element d D do
If NOT-VISITED(d) then
Add(Q, d);
}
Q
The Hamiltonian Path problem:
See Fig.6-13
Hill Climbing
A variant of DFS that uses a heuristic to order the descendents when expanding.
Q
The 8-puzzle problem
Define the evaluation function f(n) on a node n to be the number of misplaced
tiles compared to the goal node.
See Fig.6-15
S←{root}
While S≠Φ do
{
P←Pop(S);
If P = goal stop;
D←descendent(P);
For each element d D in descending order of f(d) do
If NOT-VISITED(d) then
Push(S, d);
}
Best-First Search
A hybrid approach of DFS and BFS, it uses an evaluation function to determine
among all candidate nodes,a node w/ least cost.
Use a heap to implement Best-First Search
H←{root}
While H≠Φ do
{
P←ExtractMin(H);
If P = goal stop;
D←descendent(P);
For each element d D do
If NOT-VISITED(d) then
Insert(H, d);
}
All the problems discussed so far are decision problems, rather than optimal
problems.
An optimization problem is the one that finds a solution among all feasible
solution that is optimal on some function.
Q
Personal assignment problem
Input:
a list of n persons ordered by some measure <P1,P2,P3,…Pn>
a partial orders < on n jobs
{ J1,J2,J3,…Jn}
a cost function Cij as the cost for assigning Pi to Jj
Output:
A bijection f from persons to jobs with the minimal cost
s.t. f(Pi)≦f(Pj) implies Pi < Pj
See Fig.6-21 for an example.
Observation:
Each topologically sorted sequence of jobs represents a feasible solution.
Traversing the topologically sorted sequence is like searching the corresponding
tree of partial order on jobs. See Fig.6-22
After we find a feasible solution, we get an Upper bound.
For each node, we can derive its Lower bound.
If the lower bound of a node is no less than the current upper bound, it can be
pruned.
Q
The 0/1 Knapsack problem
Input
profits of n items:P1,P2,…Pn
weights of n items:W1,W2,…Wn
maximun weight a thief can carry: M
Output
A set of items that maximize the profits while under the thief’s carrying
capacity.
Formal representation
Xi = 0 or 1, 1≦i≦n
n
Maximize PiXi
i 1
n
Subject to WiXi ≦ M
i 1
Transform to
n
Minimize PiXi
i 1
n
Subject to WiXi ≦ M
i 1
In case 3, this lower/upper bound could become the new global upper bound.
Cases 1 and 2, however, should be pruned
A branch is placed on a node with the smaller lower bound.
Heuristics:
1. For any pair of job sets that yield the same descendant sets, arbitrarily choose
one.
e.q. (C.E) and (D,P) of Fig.6-31 at level 2.
2. Priority is given to internal nodes when it comes to expand.
3. A schedule S will not be optimal if P(S,i) P(S’,i) for some other schedules
where P(S,i) indicates the set of completed jobs at time slot i.
See Fig.6-34
4. If the number of accumulated processors of a schedule S is greater than that of a
feasible schedule, S cannot be optimal.
See Fig.6-34
The A* Algorithm
We can view A* as a specialization of the more general branch and bound strategy.
2. The search is conducted by using best first search with f(n) being the cost
function.
Q
See Fig.6-36 and P.341 for an example.
h(n) ≡ the minimum of all the outgoing edge lengths.
8-puzzle in Fig.6-15 (P.303)
Q
Channel Assignment Problem
Input:A set of intervals with integer terminals.
Output:An assignment of intervals to tracks.
Horizontal constraint:intervals that are assigned to the same track do not intersect.
Vertical constraint:intervals with the same terminals do not intersect vertically.
Legal
illegal
Algorithm.
A. Form a search tree
1. From vertical constraint graph, choose a sets of nodes whose in-degree = 0.
2. For the subgraph of horizontal constraint graph formed by S, find its
maximum cliques.
3. Each maximum clique represents a possible track. Delete these nodes from
the horizontal and vertical constraint graph, go to step 1.