Abstract

We found the magic square a simple problem with a very rich combinatorics : for a magic square of order n, there are n²! manners to fill tbe nxn matrix with integers between 1 and n2, without repetitions, but only very few of them are magic squares (Ball, 1963).

For order 4 there are exactly 7040 magic squares. So we use the magic square as a benchmark to compare mathematical programming, namely mixed integer programming (MIP), with Genetic Algorithms (GAs), that we will show are much more powerful to solve these kind of discrete combinatorial explosive problems. Finally we developed an artificial intelligence randomized minimax algorithm that imitates a human solving the magic square and we showed that in most cases its performance, in terms of number of changes of pairs of numbers, is better than the performance of the GA algorithm.

Text

Download Facsimile [PDF, 2.9M]

References

Bibliographical reference

José Barahona da Fonseca, « The Magic Square as a Benchmark », CASYS, 18 | 2006, 27-33.

Electronic reference

José Barahona da Fonseca, « The Magic Square as a Benchmark », CASYS [Online], 18 | 2006, Online since 10 October 2024, connection on 10 November 2024. URL : http://popups.lib.uliege.be/1373-5411/index.php?id=2201

Author

José Barahona da Fonseca

Department of Electrical Engineering and Computer Science, Faculty of Sciences and Technology, New University of Lisbon, Monte de Caparica, 2829-516 Caparica, Portugal

By this author

Copyright

CC BY-SA 4.0 Deed