Title: Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem
1Systematic Search Guided by Local Search with
Conflict-based Heuristic in N-queen problem
Florida Institute of Technology Department of
Computer Science
- Hyoung rae Kim
- Debasis Mitra Ph.D
2Contents
- Introduction
- Proposed method
- Implementation design
- Experiments and analysis
- Related work
- Conclusion
- Future works
- References
gt
gt
gt
gt
gt
1
31. Introduction
- Constraint Satisfaction Problem(CSP) does very
important role in Artificial Intelligence (AI).
CSP appears in many areas, for instance vision,
resource allocation in scheduling and temporal
reasoning 2. - What is a constraint satisfaction problem
- A CSP is a problem composed of a finite set of
variables, each of which is associated with a
finite domain, and a set of constraints. - The task is to assign a value to each variable
satisfying all the constraints.
1
4Resource allocation in scheduling
2
1
5N-queens problem
- Place eight queens on an 8 8 chessboard
satisfying the constraint that no two queens
should be on the same row, column or diagonal.
4 4 queens problem
1
6N-queens problem
- Problem formalization
- The set of variables Z Q1, Q2, , Q8
- Domain DQ1 DQ2 DQ8 1,2,3,4,5,6,7,8
- Constraint (1) ?i,j Qi?Qj
- Constraint (2) ?i,j, if Qia and Qjb, then i-j
? a-b, and i-j ? b-a. - The variable is considered row number.
- The domain of each variable is set of column
numbers.
1
7Problem reduction and search
- There are two approaches to solve CSP
- Problem reduction
- Pruning off search spaces that contain no
solution - Reducing the size of domains of the variables
Tightening constraints potentially reduce the
search space at a later stage of the search - Pruning off branches in the search space
- It can be performed at any stage of the search
- Search
- Find solution in the search space, all or one of
the solutions. - One often has to find a balance between the
efforts made and the potential gains in problem
reduction.
1
8An example of a search space
1
9Search strategies
- Systematic algorithm
- Starts from an empty variable assignment that is
extended until obtaining a complete assignment
that satisfies all the constraints in the
problem. - Look-back enhancements (backward checking, back
jumping, etc.) - Look-ahead enhancements (forward checking, etc.)
- Local search algorithm
- Perform an incomplete exploration of the search
space by repairing infeasible complete
assignments (min-conflict, GSAT, tabu search). - Hybrid approach
- Performing a local search before or after a
systematic search. - Performing a systematic search improved with a
local search at some point of the search. - Performing an overall local search, and using
systematic search either to select a candidate
neighbor or to prune the search space 1.
1
10The contributions of this work
- Explain the relationship between Local search
algorithm (MC) and Systematic algorithm (FC). - Trying to find faster searching algorithm by
combining them.
1
112. Proposed method
- We improve the speed by hybrid of Forward
Checking and Min-Conflict Forward checking after
Min-conflict. - We examine the complexity and accuracy as
gradually varying the coverage of Min-conflict.
1
12Forward checking algorithm
(12)
(12)
(4)
(4)
(5)
(1)
(2)
Total comparison 40
(0)
1
13Forward checking algorithm
- FC1 (UNLABELLED, COMPOUND_LABEL, D,C)
- if (UNLABELLED) return UNLABELLED
- Pick one variable x from UNLABELLED
-
- pick one value v from Dx Delete v from Dx
- DUpdate1(UNLABELLED-X, D, C, ltx,vgt)
- Result FC1 (UNLABELLED-X,
COMPOUND_LABELltx,vgt, D, C) - if (Result ! Nil) return Result
- until (Dx)
- return (NIL)
S
14- Update1(W,D,C,Lable)
-
- DD
- for each variable y in W
- for each value v in Dy
- if (lty,vgt is incompatible with Label with
respect to the constraints in C) - DyDy-v
-
-
- return D
S
15Min-conflict algorithm
Checking (1)
Initial status
Ordering (16)
Checking (1)
Checking (1)
Ordering (10)
Ordering (7)
Checking (3)
C(3)
Checking (5)
Ordering (8)
Total comparison 71
Checking (2)
2
Ordering (7)
16Min-conflict algorithm
- Informed_Backtrack(Z,D,C)
-
- LEFT
- for each variable x in Z
- pick a random value from Dx
- add ltx,vgt to LEFT
-
- InfBack(LEFT, , D, C)
S
17- InfBack(LEFT, DONE, D,C)
-
- if (LEFTDONE is compatible with constraints)
- return LEFTDONE
- x any variable such that label ltx,vgt is in
LEFT - Queue Order_values(x, Dx, Labels_left,
Labels_done, C) - while (Queue ! )
- w first element in Queue Delete w from
Queue - DONE DONE ltx,wgt
- Result InfBack(LEFT-ltx,vgt, DONE, D, C)
- if (Result ! Nil) return Result
-
- return Nil
S
18- Order_values(x, Dx, LEFT, DONE, C)
-
- List
- for each v in Dx
- if (ltx,vgt is compatible with all the labels in
DONE) -
- Count v 0
- for each lty,wgt in LEFT
- if NOT satisfies ((ltx,vgtlty,wgt), Cx,y)
- Countvcountv1
-
- List List v
-
-
- Queue the values in List ordered in ascending
order of Countv - return Queue
S
19Comparison between MC and FC
- Forward checking (FC)
- Advantage Completeness it always find a
solution if one exists. One of the best
Systematic algorithm. - Disadvantage FC is typically cursed with early
mistakes in the search, a wrong variable value
can cause a whole sub-tree to be explored with no
success. - Min-conflict (MC)
- Advantage Do not suffer from the early-mistake
problem. It may be far more efficient than
systematic ones to find a first solution. - Disadvantage Not complete. It can be undone,
without having anything to prove.
1
20Explanation of hybrid method
- Forward checking after Min-conflict.
- K0 means pure FC, Kn means pure MC.
Solve this portion by MC
K Vary this K value
Solve this portion by FC
1
8-queens problem
213. Implementation design
- Input variable N-queens problem
- Output variable
- Counted number of visited label.
- Counted number of executed constraints.
- MC-FC algorithm runs MC and then FC with the
results from MC. - We use standard MC algorithm 2.
- We use standard FC algorithm 2.
1
22Hybrid algorithm
K2
MC
FC
2
23Hybrid algorithm
- SEARCH (n)
- for each k0 to n
- 1. MC_FC (k, Success, Count_Label,
Count_Constraint) - 2. print (k, Success, Count_Label,
Count_Constraint) -
- MC_FC (k, Success, Count_Label, Count_Constraint)
- Repeat until it gets a result or reach to the
max iteration - 1. Initialize cZ, cD, CC
- 2. COMPOUND_LABEL MC(k, cZ, cD, cC,
Count_Label, Count_Constraint) - 3. If COMPOUND_LABEL is valid
- ResultFC(k,COMPOUND_LABEL,
-
cZ,cD,cC,Count_Label,Count_Constraint) - 4. If Result is valid
- Success True
- return
S
244. Experiment and analysis
- We use 24-queens problem.
- We ran the algorithm 300 times on a Sun Ultra 60.
- The max iteration number was 1000 (if FC part
does not have solutions, it randomly re-execute
MC part). - We recorded every k value from 0 through n with
an interval of 2. - An output parameter Label count is the number
of label that the algorithm visited. - The other parameter Total count is the number
of how many times the constraint is checked.
Total count subsumes the Label count. - We analyze the Label count and Total count.
- We use this formula to compare the quality of
data points, which is often referred to as
standard error of the mean - S.D. of Total count / Sqrt(n) 3.
1
25Compare the label count
1
26Complexity
Pure Forward checking
Plot label count in a graph
Pure Min Conflict
1
k
k
27Compare the total count
1
28Complexity
Pure Forward checking
Plot total count in a graph
Pure Min Conflict
1
k
29Explanation of the results
- The reason of gradual shrinking of the width.
- 4-queens problem has two solutions with following
conditions. - When K1,
- There are two solution marks (called A), it takes
4 steps to know the results. - There are two un-solution marks (called B), it
takes 6 steps to know the results. - Starts with solution mark A (50) 4
- Starts with un-solution mark B (50) 10
- When K2,
- There are two solution marks (called A), it takes
2 steps to know the results. - There are four un-solution marks, 2 has 1step
(called B), 2 has 2 steps (called C). - Starts with solution mark (34) 2
- Starts with un-solution mark, B -gt A (16.5) 3
- Starts with un-solution mark, B -gt C -gt A
(16.5) 5 - Starts with un-solution mark, C -gt A (16.5) 4
- Starts with un-solution makr, C-gt B -gt A (16.5)
5 - This tells when K2 the S.D is much smaller.
- Case 1124,10,4,10,, S.D. 3.1 Case
2122,2,3,5,4,5,, S.D. 1.3
2
30- As for the reduction of the complexity We are
trying to find the explanation.
1
315. Related work
- A research tried to show that the look-back and
look-ahead enhancements of backtracking-based
algorithms can be exploited for local search
algorithms, and can greatly improve their
behavior too. They propose a generic search
technique over CSP which is called
decision-repair, which show great performance
1.
S
326. Conclusion
- We performed a hybrid search Performing a local
search (MC) before a systematic search (FC). - The purpose of our research is to understand the
relationship between MC and FC and to improve the
speed of searching algorithm. - The algorithm shows the best performance when K
value is in the middle. - We need theoretical explanation for this results.
- Even without the theoretical explanation, the
Hybrid algorithm is better than pure MC and FC.
1
337. Future works
- Vary N to bigger number.
- For other problems other than N-queens.
- Theoretical studies for the result.
1
348. References
- 1 N. Jussien, O. Lhomme, Local Search with
Constraint Propagation and Conflict-absed
Heuristics, Artificial Intelligence 139 (2002)
21-45. - 2 E. Tsang, Foundations of Constraint
Satisfaction, University of Essex Colchester
Essex, UK., (1995). - 3 John Mandel, The statistical analysis of
experimental data, Dover, (1964) 63.
1