Research Article
Parallel Implementations of Candidate Solution Evaluation Algorithm for N-Queens Problem
| Input: | | Output: | (1) | begin 2 int∗ m_NQ;/∗ array name ∗/ | (3) | int m_N;/∗ array length ∗/ | (4) | int m_sum;/∗ result ∗/ | (5) | FunctionNQClass (int NQ[], int N): | (6) | m_NQ NQ | (7) | m_N N | (8) | m_sum 0 | (9) | End Function | (10) | Function NQClass (NQClass x,split) | (11) | m_NQ x.m_NQ | (12) | m_N x.m_N | (13) | m_sum 0 | (14) | End Function | (15) | Function SubTask () | (16) | conflict 0; | (17) | For int j = i + 1; j < N; ++j/∗ for every index after i ∗/ | (18) | do | (19) | if = = j–ithen | (20) | conflict++ | (21) | end | (22) | end | (23) | End Function | (24) | Function operator (const blocked_range int & r): | (25) | int end r.end() | (26) | For int i = r.begin(); i end; ++i) do | (27) | | (28) | end | (29) | End Function | (30) | Function join (const NQClass & y): | (31) | m_sum + = y.m_sum | (32) | End Function | (33) | end |
|