Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem

1 / 34

# Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem - PowerPoint PPT Presentation

Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem. Hyoung rae Kim Debasis Mitra Ph.D. Florida Institute of Technology Department of Computer Science. Contents. Introduction Proposed method Implementation design Experiments and analysis Related work

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem' - duy

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem

Hyoung rae Kim

Debasis Mitra Ph.D

Florida Institute of Technology

Department of Computer Science

Contents
• Introduction
• Proposed method
• Implementation design
• Experiments and analysis
• Related work
• Conclusion
• Future works
• References

>

>

>

>

>

1

1. 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

N-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

N-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 Qi=a and Qj=b, 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

Problem 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

Search 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

The 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

2. 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

Forward checking algorithm

(12)

(12)

(4)

(4)

(5)

(1)

(2)

Total comparison: 40

(0)

1

Forward 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;

D’=Update1(UNLABELLED-{X}, D, C, );

Result = FC1 (UNLABELLED-{X}, COMPOUND_LABEL+{}, D’, C);

if (Result != Nil) {return Result;};

} until (Dx={});

return (NIL);

}

S

Update1(W,D,C,Lable)

{

D’=D;

for each variable y in W {

for each value v in D’y {

if ( is incompatible with Label with respect to the constraints in C)

D’y=D’y-{v};

}

}

return D’;

}

S

3

2

3

1

Min-conflict algorithm

Initial status

Checking (1)

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)

Min-conflict algorithm

Informed_Backtrack(Z,D,C)

{

LEFT = {};

for each variable x in Z {

pick a random value from Dx;

}

InfBack(LEFT, {}, D, C);

}

S

InfBack(LEFT, DONE, D,C)

{

if (LEFT+DONE is compatible with constraints)

{return LEFT+DONE;};

x = any variable such that label 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 + {};

Result = InfBack(LEFT-{}, DONE, D, C):

if (Result != Nil) {return Result;};

}

return Nil;

}

S

Order_values(x, Dx, LEFT, DONE, C)

{

List = {};

for each v in Dx {

if ( is compatible with all the labels in DONE)

{

Count [v] = 0;

for each in LEFT {

if NOT satisfies ((), Cx,y)

Count[v]=count[v]+1;

}

List = List + {v};

}

}

Queue = the values in List ordered in ascending order of Count[v];

return Queue;

}

S

Comparison 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

Explanation of hybrid method
• Forward checking after Min-conflict.
• K=0 means pure FC, K=n means pure MC.

Solve this portion by MC

K

* Vary this K value

Solve this portion by FC

1

[8-queens problem]

3. 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

Hybrid algorithm

SEARCH (n) {

for each k=0 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

Result=FC(k,COMPOUND_LABEL,

cZ,cD,cC,Count_Label,Count_Constraint)

4. If Result is valid

Success = True

return;

}

S

4. 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

Complexity

Pure Forward checking

Plot label count in a graph

Pure Min Conflict

1

k

k

Complexity

Pure Forward checking

Plot total count in a graph

Pure Min Conflict

1

k

Explanation of the results
• The reason of gradual shrinking of the width.
• 4-queens problem has two solutions with following conditions.
• When K=1,
• 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 K=2,
• 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 -> A (16.5%) : 3
• Starts with un-solution mark, B -> C -> A (16.5%): 5
• Starts with un-solution mark, C -> A (16.5%): 4
• Starts with un-solution makr, C-> B -> A (16.5%): 5
• This tells when K=2 the S.D is much smaller.
• Case 1=12={4,10,4,10,…}, S.D. = 3.1; Case 2=12={2,2,3,5,4,5,…}, S.D. = 1.3

2

5. 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

6. 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

7. Future works
• Vary N to bigger number.
• For other problems other than N-queens.
• Theoretical studies for the result.

1

8. 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