add a method 'checkGradient' for NonlinearConstraint to check if the numerical gradeint and the user gradient matches. Also check if the sparsity pattern of the gradient matrix is correct