Research Article
Parallel Implementations of Candidate Solution Evaluation Algorithm for N-Queens Problem
Algorithm 3
Calculation of conflicts with multithreaded.
| | Input: , | | | Output: | | (1) | for int i = 0; i < thr_num; i++;/∗ start thr_num threads ∗/ | | (2) | do | | (3) | thread (thread_func,NQ,N,i,thr_num,conflict_arr) | | (4) | end | | (5) | for int i = 0; i < thr_num; i++; /∗ wait for threads finish ∗/ | | (6) | do | | (7) | .join() | | (8) | end | | (9) | conflicts accumulate (conflict_arr, conflict_arr + thr_num, 0) |
|