Randomize guess in gradient descent test

Randomly perturb the pre-solved part of the guess, and randomly choose
the unsolved part.
This commit is contained in:
Aaron Fenyes 2024-07-07 17:56:12 -07:00
parent d39244d308
commit ea354b6c2b

View File

@ -3,6 +3,7 @@ include("Engine.jl")
using SparseArrays using SparseArrays
using AbstractAlgebra using AbstractAlgebra
using PolynomialRoots using PolynomialRoots
using Random
# initialize the partial gram matrix for an arrangement of seven spheres in # initialize the partial gram matrix for an arrangement of seven spheres in
# which spheres 1 through 5 are mutually tangent, and spheres 3 through 7 are # which spheres 1 through 5 are mutually tangent, and spheres 3 through 7 are
@ -34,13 +35,17 @@ gram[1, 6] = gram[6, 1]
# in this initial guess, the mutual tangency condition is satisfied for spheres # in this initial guess, the mutual tangency condition is satisfied for spheres
# 1 through 5 # 1 through 5
guess = sqrt(1/BigFloat(2)) * BigFloat[ Random.seed!(50793)
1 1 -1 -1 0 -0.1 0.3; guess = hcat(
1 -1 1 -1 0 -0.5 0.4; sqrt(1/BigFloat(2)) * BigFloat[
1 -1 -1 1 0 0.1 -0.2; 1 1 -1 -1 0;
0 0 0 0 -sqrt(BigFloat(6)) 0.3 -0.2; 1 -1 1 -1 0;
1 1 1 1 2 0.2 0.1; 1 -1 -1 1 0;
] 0 0 0 0 -sqrt(BigFloat(6));
1 1 1 1 2;
] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)),
Engine.rand_on_shell(fill(BigFloat(-1), 2))
)
# complete the gram matrix using gradient descent # complete the gram matrix using gradient descent
L, history = Engine.realize_gram(gram, guess) L, history = Engine.realize_gram(gram, guess)