Skip to content

Instantly share code, notes, and snippets.

@fuglede
Last active February 9, 2024 08:03
Show Gist options
  • Save fuglede/5388f4246b161ce46b4989d880e2cb86 to your computer and use it in GitHub Desktop.
Save fuglede/5388f4246b161ce46b4989d880e2cb86 to your computer and use it in GitHub Desktop.
Knight's tour with graph traversal, constraint programming, and integer programming
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TahaRostami
Copy link

Interesting. Thank You!

@Ynfiniti
Copy link

Ynfiniti commented Feb 7, 2024

Very cool post, thanks!

One small detail tho: I have noticed, that in the Solution for the 8×8 Grid, solved with Integer linear programming, the cell 11 has the value 5 which should be a 6 because the 5th step is at cell 1.

@fuglede
Copy link
Author

fuglede commented Feb 9, 2024

@Ynfiniti Hah, good catch. What's happening is probably that one gets small floating point errors from Xpress, even though all variables were declared to be integers. Avoiding that amounts to rounding to the nearest integer instead of rounding down as the code does at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment