Question: can you help with problem 2.4? 2 Optimization [6pts] Introduction A magic square is defined as a n x n square array of the numbers
can you help with problem 2.4?
2 Optimization [6pts] Introduction A magic square is defined as a n x n square array of the numbers 1, 2 ... n' where each row, column and diagonal sum to the same value. A magic square of size n = 3 is shown in Figure 2, and its rows, columns, and diagonals sum to 15, the target sum. 816 357 492 Figure 2: Sample valid 3 x 3 magic square with row, column, and diagonal sum of 15 Row Sums Column Sums Diagonal Sums 8+1+6=153+5+7=154+9+2=15 8+3+4=151+5+9=156+7+2=15 8+5+2=156+5+4=15 Table 2: Row, Column, and Diagonal Sum calculations for Figure 2 For a size 3 magic square, there are a total of 8 solutions. Note that we consider rotations and reflections as distinct magic squares. While finding a solution for a size 3 magic square is quite trivial, the problem of finding a solution for magic squares of larger sizes is a more complex problem in combinatorics that often requires the use of optimization algorithms. We will stick with a magic square of size 3 in this problem but develop an idea of how we can use evolutionary algorithms to find a solution. Let us define a valid square as a square in which no digit appears more than once. An example comparing a valid and an invalid square can be seen in Figure 3. In this optimization problem, the evolutionary algorithm is only allowed to generate valid squares, any invalid squares generated will be removed and not considered in the problem. 654781932 619 (a) A valid square 537 228 (b) An invalid square Figure 3: Note that (b) is invalid because the digit 2 appears twice 10 ATISVICI 2.4 Optimization Q4 [1pt] Given the valid square in Figure 7, what is the worst fitness (largest fitness score value) that can be obtained from the square with one mutation?Given the valid square in Figure 7, what is the best fitness (smallest fitness score value) that can be obtained from the square with one mutation? Figure T: Square for (3 and (4 Answer as a whole number. 24 Optimization Q4 [1pt] (Given the valid square in Figure 7, what iz the worst fitness (largest fitness score value) that can be obtained from the square with one mutation? Answer as a whole number
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
Students Have Also Explored These Related Law Questions!