I am running into an INFO 51 error when trying to solve an optimization problem using SNOPT through the Matlab interface. The full output file with verify_level 3 is attached with this email.
From what I understand this error corresponds to incorrect gradient computation. The specific discrepancy is highlighted in the output as follows
I am analytically computing gradients for my objective function and constraints. The objective and constraints vector F has the following form where x and w are the variables of the optimization
F = [x'Hx + c'x + lambda*norm(w, 1); % objective
norm(x, 1); % L1 constraint
A*[x; w] % linear constraint ]
The gradient calculation is performed analytically.
G = [2*x'*H' + c', lambda*sign(w');
sign(x'), zeros(1, length(w));
A]
I tried to check my objective and constraints function by numerically computing the gradients (central differencing with a step size of 1e-4) and comparing them with those returned by my function and the largest discrepancy I get is of the order of 1e-5 which is nothing close to what SNOPT's gradient checker is reporting. Furthermore, the objective gradient check reports a huge discrepancy in magnitude and sign which is also difficult to understand.
Additionally, I also provide the structure of the gradient/jacobian to the optimization and I tried comparing my structure with that returned by snJac which also leads to a discrepancy where snJac treats gradients of some of the linear constraints as non-constant (which is also hard to understand since the gradient is simply the constant matrix A in the above description). Furthermore, for different initial points (randomly generated), the snJac output is different (again for the linear constraints!) which is surprising since the linear constraint gradient is (or should be) a constant matrix!
My initial guess to the optimization problem is not feasible and I don't have a good way to provide a feasible initial point in general. When I do try to solve the problem (with the same objective and constraints function) in a trivial setting where I know the optimal solution the optimization returns with INFO 1. Any help in debugging this would be greatly appreciated.
Best,
Ashwin Khadke