目前我有一个正在运行的骑士之旅算法。
我使用以下组合:
- 回溯
- 华恩斯多夫规则
该算法执行以下操作:
Checks to see if the board is solved (all squares visited)
If true: return true
else proceed:
Make a set of possible moves from current positions
Sort the set based on the number of moves available from those positions.
Go through the set. (Recursive call made here)
If returned True:
Set Solution board to appropriate number
Return true
else
go back to last position
return false.
它工作正常。这不是最好的解决方案。
我正在尝试使用并行化来提高速度,特别是使用 C++ 线程 ( #include<thread>
)。
这是什么算法?到目前为止,我尝试过的唯一方法有错误共享问题、共享内存问题或根本无法运行。