Research Article
Parallel Implementations of Candidate Solution Evaluation Algorithm for N-Queens Problem
| Input: | | Output: | (1) | ⟵ 0; /∗ clear counter ∗/ | (2) | batchs (N + thr_num -1)/thr_num;/∗ get task batchs ∗/ | (3) | for int batch = 0; batch < batchs; batch++ do | (4) | i = thr_num batch + thr_idx; /∗ get position i ∗/ | (5) | for j = i + 1; j < N; ++j do | (6) | if = = j–i then | (7) | ++; | (8) | end | (9) | end | (10) | end |
|