Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Knight's tour
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Finding tours with computers== There are several ways to find a knight's tour on a given board with a computer. Some of these methods are [[algorithm]]s, while others are [[heuristic]]s. ===Brute-force algorithms=== A [[brute-force search]] for a knight's tour is impractical on all but the smallest boards.<ref name=Simon01a>{{citation|title=Evolutionary Optimization Algorithms|first=Dan|last=Simon|publisher=John Wiley & Sons|year=2013|isbn=9781118659502|pages=449–450|url=https://books.google.com/books?id=gwUwIEPqk30C&pg=PA449|quote=The knight's tour problem is a classic combinatorial optimization problem. ... The cardinality ''N<sub>x</sub>'' of ''x'' (the size of the search space) is over 3.3×10<sup>13</sup> (Löbbing and Wegener, 1995). We would not want to try to solve this problem using brute force, but by using human insight and ingenuity we can solve the knight's tour without much difficulty. We see that the cardinality of a combinatorial optimization problem is not necessarily indicative of its difficulty.}}</ref> On an {{nowrap|8 × 8}} board, for instance, there are {{val|13,267,364,410,532|fmt=commas}} knight's tours,<ref name=lw96/> and a much greater number of sequences of knight moves of the same length. It is well beyond the capacity of modern computers (or networks of computers) to perform operations on such a large set. However, the size of this number is not indicative of the difficulty of the problem, which can be solved "by using human insight and ingenuity ... without much difficulty."<ref name=Simon01a/> ===[[Divide-and-conquer algorithm]]s=== By dividing the board into smaller pieces, constructing tours on each piece, and patching the pieces together, one can construct tours on most rectangular boards in [[time complexity#Linear time|linear time]] – that is, in a time proportional to the number of squares on the board.<ref name=Cull1978>{{cite journal|last= Cull|first= P.|author2=De Curtins, J.|title= Knight's Tour Revisited|journal= Fibonacci Quarterly|volume= 16|year= 1978|issue= 3|pages= 276–285 |doi= 10.1080/00150517.1978.12430328|url=https://www.fq.math.ca/Scanned/16-3/cull.pdf |archive-url=https://ghostarchive.org/archive/20221009/https://www.fq.math.ca/Scanned/16-3/cull.pdf |archive-date=2022-10-09 |url-status=live}}</ref><ref>{{cite journal|last= Parberry|first= Ian|title= An Efficient Algorithm for the Knight's Tour Problem|journal= Discrete Applied Mathematics|volume= 73|issue= 3|year= 1997|pages= 251–260|doi=10.1016/S0166-218X(96)00010-8 |url=https://core.ac.uk/download/pdf/81964499.pdf |archive-url=https://ghostarchive.org/archive/20221009/https://core.ac.uk/download/pdf/81964499.pdf |archive-date=2022-10-09 |url-status=live|doi-access= free}}</ref> ===Warnsdorf's rule=== {{Chess diagram | tright | | | | | | | | | | | | | | | | | |x3| |x7| | | | | | | | |x7| | | | | |nl| | | | | | | | | |x7| | | | |x2| |x5| | | | | | | | | | | | | |A graphical representation of Warnsdorf's Rule. Each square contains an integer giving the number of moves that the knight could make from that square. In this case, the rule tells us to move to the square with the smallest integer in it, namely 2. }} [[File:Knight's Tour of 130x130 Square Board.png|thumb|A very large (130 × 130) square open knight's tour created using Warnsdorf's Rule]] Warnsdorf's rule is a [[heuristic]] for finding a single knight's tour. The knight is moved so that it always proceeds to the square from which the knight will have the ''fewest'' onward moves. When calculating the number of onward moves for each candidate square, we do not count moves that revisit any square already visited. It is possible to have two or more choices for which the number of onward moves is equal; there are various methods for breaking such ties, including one devised by Pohl<ref name="pohl"/> and another by Squirrel and Cull.<ref>{{cite web |url=https://github.com/douglassquirrel/warnsdorff/blob/master/5_Squirrel96.pdf?raw=true |title=A Warnsdorff-Rule Algorithm for Knight's Tours on Square Boards |access-date=2011-08-21 |last=Squirrel |first=Douglas |author2=Cull, P. |website=[[GitHub]] |year=1996}}</ref> This rule may also more generally be applied to any graph. In graph-theoretic terms, each move is made to the adjacent vertex with the least [[degree (graph theory)|degree]].<ref name="Van Horn et. al">{{cite conference| first=Gijs| last=Van Horn| author2=Olij, Richard| author3=Sleegers, Joeri| author4=Van den Berg, Daan| title=A Predictive Data Analytic for the Hardness of Hamiltonian Cycle Problem Instances| conference=DATA ANALYTICS 2018: The Seventh International Conference on Data Analytics| publisher=[[Xpert Publishing Services|XPS]]| location=Athens, greece| pages=91–96| year=2018| url=https://pure.uva.nl/ws/files/30312375/_2018_Van_Horn_et_al_A_Predictive_Data_Analytic.pdf| access-date=2018-11-27| isbn=978-1-61208-681-1}}</ref> Although the [[Hamiltonian path problem]] is [[NP-hardness|NP-hard]] in general, on many graphs that occur in practice this heuristic is able to successfully locate a solution in [[linear time]].<ref name="pohl">{{cite journal|last= Pohl|first= Ira|title= A method for finding Hamilton paths and Knight's tours|journal= Communications of the ACM|volume= 10|issue= 7|date= July 1967|pages= 446–449|doi= 10.1145/363427.363463|citeseerx= 10.1.1.412.8410|s2cid= 14100648}}</ref> The knight's tour is such a special case.<ref name="alwan-waters">{{cite conference| first=Karla |last=Alwan|author2=Waters, K. |title=Finding Re-entrant Knight's Tours on N-by-M Boards|conference=ACM Southeast Regional Conference| publisher=[[Association for Computing Machinery|ACM]]| location=New York, New York| pages=377–382| year=1992| doi= 10.1145/503720.503806}}</ref> The [[heuristic]] was first described in "Des Rösselsprungs einfachste und allgemeinste Lösung" by H. C. von Warnsdorf in 1823.<ref name="alwan-waters"/> A computer program that finds a knight's tour for any starting position using Warnsdorf's rule was written by Gordon Horsington and published in 1984 in the book ''Century/Acorn User Book of Computer Puzzles''.<ref>{{cite book |title=Century/Acorn User Book of Computer Puzzles|editor-first=Simon|editor-last=Dally|isbn=978-0712605410|year=1984|publisher=Century Communications }}</ref> ===Neural network solutions=== [[File:Knight's Tour 24x24.svg|right|thumb|250px|Closed knight's tour on a {{nowrap|24 × 24}} board solved by a neural network]] The knight's tour problem also lends itself to being solved by a [[Artificial neural network|neural network]] implementation.<ref>Y. Takefuji, K. C. Lee. "Neural network computing for knight's tour problems." ''Neurocomputing'', 4(5):249–254, 1992.</ref> The network is set up such that every legal knight's move is represented by a [[artificial neuron|neuron]], and each neuron is initialized randomly to be either "active" or "inactive" (output of 1 or 0), with 1 implying that the neuron is part of the solution. Each neuron also has a state function (described below) which is initialized to 0. When the network is allowed to run, each neuron can change its state and output based on the states and outputs of its neighbors (those exactly one knight's move away) according to the following transition rules: ::<math display="block"> U_{t+1} (N_{i,j}) = U_t(N_{i,j}) + 2 - \sum_{N \in G(N_{i,j})} V_t(N) </math> ::<math display="block"> V_{t+1} (N_{i,j}) = \left\{ \begin{array}{ll} 1 & \mbox{if}\,\, U_{t+1}(N_{i,j}) > 3\\ 0 & \mbox{if}\,\, U_{t+1}(N_{i,j}) < 0\\ V_t(N_{i,j}) & \mbox{otherwise}, \end{array} \right. </math> where <math>t</math> represents discrete intervals of time, <math>U(N_{i,j})</math> is the state of the neuron connecting square <math>i</math> to square <math>j</math>, <math>V(N_{i,j})</math> is the output of the neuron from <math>i</math> to <math>j</math>, and <math>G(N_{i,j})</math> is the set of neighbors of the neuron. Although divergent cases are possible, the network should eventually converge, which occurs when no neuron changes its state from time <math>t</math> to <math>t+1</math>. When the network converges, either the network encodes a knight's tour or a series of two or more independent circuits within the same board.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Knight's tour
(section)
Add topic