La pregunta pide alternativas a la fuerza bruta, pero sólo para ilustrar las dificultades de usar la fuerza bruta, aquí está el código python para forzarla:
import numpy as np
import itertools
import time
MATRIX_SIZE = 3 #3 for a 3x3 matrix, etc
best_matrices = []
highest_det = 0
start_time = time.process_time()
def report():
print(round(time.process_time() - start_time,4) ,"\t",
iteration, "/", num_permutations, round(100*iteration/ num_permutations,2), "% \t",
permutation, "\tdet=",det,"(prev best det",highest_det,")")
num_permutations = np.math.factorial(MATRIX_SIZE**2)
iteration = 0
for permutation in itertools.permutations(range(1, MATRIX_SIZE*MATRIX_SIZE+1)):
iteration += 1
matrix = np.array(permutation).reshape((MATRIX_SIZE, MATRIX_SIZE))
det = round((np.linalg.det(matrix)) )
if det > highest_det:
report()
highest_det = det
best_matrices = [permutation]
elif det==highest_det:
report()
best_matrices.append(permutation)
total_time = time.process_time() - start_time
#print("List of the matrices with the highest determinant:\n", *best_matrices, sep='\n')
print(len(best_matrices), "matrices found")
print("which all have determinant", highest_det)
print("\ntime taken:", total_time)
Mi máquina tardó 3 segundos para una matriz de 3x3. Parece que tomaría varios años para una matriz de 4x4...
Aunque con un poco de reflexión se podría acortar el proceso.
Hay 36 matrices con un determinante de 412 y 36 con un determinante de -412.
Todas las matrices con det 412 tienen 7,8,9 en cols separadas y filas separadas, como alguien más mencionó.
1 votos
Sólo hay 362.880 posibilidades de comprobar...
1 votos
La regla de Sarrus podría ser un punto de partida. Ellos utilizan la optimización lineal. ¿Qué tal si se hace con las filas (9,2,4), (6,8,1) y (3,5,7) como punto de partida? Entonces la suma positiva es 9,8,7 + 6,5,4 + 3,2,1. Es sólo una idea.
0 votos
Aparentemente el máximo determinante es 412 y el maximizador es $A=\pmatrix{1&4&8\\ 7&2&6\\ 5&9&3}$ .