現在、機能している騎士のツアーアルゴリズムがあります。
私は次の組み合わせを使用します:
- バックトラッキング
- ワーンスドルフの法則
このアルゴリズムは次のことを行います。
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>
ます。
これのアルゴリズムは何ですか?これまでのところ、私が試した唯一の方法は、誤った共有の問題、共有メモリの問題があるか、まったく実行されません。