Abstract

The construction of magic squares is a complex permutation and combination problem. It is very difficult to construct the magic square with the continuous minimum natural number, and its solution has the nature of diversity and increases exponentially with the increase of order. In this paper, the magic square is constructed by selecting specific real numbers in different situations. Firstly, the magic square model is realized by using genetic algorithm, and the population is selected, crossed and mutated, and the optimal solution is selected, so that the semi-magic square whose sum of rows and columns is magic sum can be generated. Then, the parent gene of diagonal magic population is generated again by row exchange and column exchange, and the data of diagonal magic population is improved. Then, the selection, crossover and diagonal local adjustment are carried out in turn, and finally, the N-order high-quality magic square in the interval of [1, N<sup>2</sup>] natural number is obtained.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call