# [Coin-ipopt] number and location of non-zeros

Susana Lera susana.lera at lsespace.com
Tue Jan 15 04:05:34 EST 2008

Hi,

Another question came to me while trying to solve my optimization problem.

My Jacobian and Hessian matrices are very complicated. Since it is very difficult for me to find out how many non-zeros there are and where they are exactly, I tried to run the program by telling it I have only non-zero entries.
For a simple example (hs071) Ipopt finds the optimal solution even though the derivative checker yields plenty of errors for the Hessian values. (see attached texts)

I am wondering how important the information on the location of non-zeros in the Jacobian and Hessian is for finding the optimum and whether the above described method may be used in general (even though the derivative checker shows several failures).

Could anybody give me some advice?

Cheers,

Susana.

________________________________________________________________________

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Common Public License (CPL).
******************************************************************************

Starting derivative checker.

grad_f[          0] =  4.0000000050599027e+00    ~  3.9999999753799460e+00  [ 7.420e-09]
jac_g [    0,    0] =  1.0000000030273490e+00 v  ~  9.9999999384498650e-01  [ 9.182e-09]
jac_g [    1,    0] =  2.0000000001550853e+00 v  ~  1.9999999876899730e+00  [ 6.233e-09]
grad_f[          1] =  1.0000000007033654e+00    ~  9.9999999307597087e-01  [ 7.627e-09]
jac_g [    0,    1] =  1.0000000022583335e+00 v  ~  9.9999999307597087e-01  [ 9.182e-09]
jac_g [    1,    1] =  2.0000000016931163e+00 v  ~  1.9999999861519417e+00  [ 7.771e-09]
grad_f[          2] =  2.0000000007033654e+00    ~  1.9999999847351217e+00  [ 7.984e-09]
jac_g [    0,    2] =  1.0000000015499235e+00 v  ~  9.9999999236756087e-01  [ 9.182e-09]
jac_g [    1,    2] =  2.0000000031099363e+00 v  ~  1.9999999847351217e+00  [ 9.187e-09]
grad_f[          3] =  3.0000000027116971e+00    ~  2.9999999798901191e+00  [ 7.607e-09]
jac_g [    0,    3] =  1.0000000024790690e+00 v  ~  9.9999999329670630e-01  [ 9.182e-09]
jac_g [    1,    3] =  2.0000000012516455e+00 v  ~  2.0000000754112546e+00  [ 3.708e-08]
obj_hess[    0,    0] =  2.0000000012516455e+00 v  ~  1.9999999876899730e+00  [ 6.781e-09]
*             obj_hess[    0,    1] =  2.0000000012516455e+00 v  ~  9.9999999384498650e-01  [ 1.000e+00]
*             obj_hess[    0,    2] =  2.0000000012516455e+00 v  ~  9.9999999384498650e-01  [ 1.000e+00]
*             obj_hess[    0,    3] =  8.0000000051132218e+00 v  ~  3.9999999753799460e+00  [ 1.000e+00]
*             obj_hess[    1,    0] =  2.0000000012516455e+00 v  ~  9.9999999307597087e-01  [ 1.000e+00]
obj_hess[    1,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
obj_hess[    1,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*             obj_hess[    1,    3] =  2.0000000001550853e+00 v  ~  9.9999999307597087e-01  [ 1.000e+00]
*             obj_hess[    2,    0] =  2.0000000012516455e+00 v  ~  9.9999999236756087e-01  [ 1.000e+00]
obj_hess[    2,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
obj_hess[    2,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*             obj_hess[    2,    3] =  2.0000000001550853e+00 v  ~  9.9999999236756087e-01  [ 1.000e+00]
*             obj_hess[    3,    0] =  8.0000000051132218e+00 v  ~  3.9999999731868252e+00  [ 1.000e+00]
*             obj_hess[    3,    1] =  2.0000000001550853e+00 v  ~  9.9999999329670630e-01  [ 1.000e+00]
*             obj_hess[    3,    2] =  2.0000000001550853e+00 v  ~  9.9999999329670630e-01  [ 1.000e+00]
obj_hess[    3,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
0-th constr_hess[    0,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     0-th constr_hess[    0,    1] =  2.0000000043615818e+00 v  ~  9.9999999384498650e-01  [ 1.000e+00]
*     0-th constr_hess[    0,    2] =  2.0000000029447618e+00 v  ~  9.9999999384498650e-01  [ 1.000e+00]
*     0-th constr_hess[    0,    3] =  2.0000000048030526e+00 v  ~  9.9999999384498650e-01  [ 1.000e+00]
*     0-th constr_hess[    1,    0] =  2.0000000043615818e+00 v  ~  9.9999999307597087e-01  [ 1.000e+00]
0-th constr_hess[    1,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     0-th constr_hess[    1,    2] =  2.0000000014067307e+00 v  ~  9.9999999307597087e-01  [ 1.000e+00]
*     0-th constr_hess[    1,    3] =  2.0000000032650216e+00 v  ~  9.9999999307597087e-01  [ 1.000e+00]
*     0-th constr_hess[    2,    0] =  2.0000000029447618e+00 v  ~  9.9999999236756087e-01  [ 1.000e+00]
*     0-th constr_hess[    2,    1] =  2.0000000014067307e+00 v  ~  9.9999999236756087e-01  [ 1.000e+00]
0-th constr_hess[    2,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     0-th constr_hess[    2,    3] =  2.0000000018482016e+00 v  ~  9.9999999236756087e-01  [ 1.000e+00]
*     0-th constr_hess[    3,    0] =  2.0000000048030526e+00 v  ~  9.9999999329670630e-01  [ 1.000e+00]
*     0-th constr_hess[    3,    1] =  2.0000000032650216e+00 v  ~  9.9999999329670630e-01  [ 1.000e+00]
*     0-th constr_hess[    3,    2] =  2.0000000018482016e+00 v  ~  9.9999999329670630e-01  [ 1.000e+00]
0-th constr_hess[    3,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     1-th constr_hess[    0,    0] =  0.0000000000000000e+00 v  ~  1.9999999876899730e+00  [ 1.000e+00]
*     1-th constr_hess[    0,    1] =  2.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 2.000e+00]
1-th constr_hess[    0,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    0,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     1-th constr_hess[    1,    0] =  2.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 2.000e+00]
*     1-th constr_hess[    1,    1] =  0.0000000000000000e+00 v  ~  1.9999999861519417e+00  [ 1.000e+00]
*     1-th constr_hess[    1,    2] =  2.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 2.000e+00]
1-th constr_hess[    1,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    2,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     1-th constr_hess[    2,    1] =  2.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 2.000e+00]
*     1-th constr_hess[    2,    2] =  0.0000000000000000e+00 v  ~  1.9999999847351217e+00  [ 1.000e+00]
*     1-th constr_hess[    2,    3] =  2.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 2.000e+00]
1-th constr_hess[    3,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    3,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
*     1-th constr_hess[    3,    2] =  2.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 2.000e+00]
*     1-th constr_hess[    3,    3] =  0.0000000000000000e+00 v  ~  1.9999999865934126e+00  [ 1.000e+00]

Derivative checker detected 32 error(s).

Number of nonzeros in equality constraint Jacobian...:        4
Number of nonzeros in inequality constraint Jacobian.:        4
Number of nonzeros in Lagrangian Hessian.............:       16

Total number of variables............................:        4
variables with only lower bounds:        0
variables with lower and upper bounds:        4
variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        1
inequality constraints with only lower bounds:        1
inequality constraints with lower and upper bounds:        0
inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
0  1.6109693e+01 1.12e+01 5.28e-01   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
1  1.7402622e+01 8.36e-01 2.12e+01  -0.3 7.81e-01    -  3.20e-01 1.00e+00f  1
2  1.7991325e+01 1.07e-02 4.68e+00  -0.3 5.59e-02   2.0 9.99e-01 1.00e+00h  1
3  1.7200839e+01 2.76e-01 3.74e-01  -0.6 5.36e-01    -  9.95e-01 1.00e+00f  1
4  1.7055792e+01 3.04e-02 2.25e-01  -1.5 4.75e-01    -  9.42e-01 1.00e+00h  1
5  1.7000108e+01 3.83e-02 1.22e-01  -2.7 6.07e-02    -  9.99e-01 1.00e+00h  1
6  1.7014050e+01 1.32e-03 2.74e-02  -4.1 1.21e-02    -  9.99e-01 1.00e+00h  1
7  1.7014032e+01 1.46e-05 1.96e-03  -5.4 1.14e-03    -  1.00e+00 1.00e+00h  1
8  1.7014017e+01 3.29e-08 1.70e-04  -7.4 1.41e-04    -  1.00e+00 1.00e+00h  1
9  1.7014017e+01 9.78e-10 3.41e-05  -9.4 2.47e-05    -  1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
10  1.7014017e+01 1.62e-11 4.40e-06 -11.0 3.18e-06    -  1.00e+00 1.00e+00h  1
11  1.7014017e+01 2.63e-13 5.61e-07 -11.0 4.05e-07    -  1.00e+00 1.00e+00h  1
12  1.7014017e+01 1.42e-14 7.15e-08 -11.0 5.16e-08    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 12

(scaled)                 (unscaled)
Objective...............:   1.7014017140224173e+01    1.7014017140224173e+01
Dual infeasibility......:   7.1548503566032280e-08    7.1548503566032280e-08
Constraint violation....:   1.4210854715202004e-14    1.4210854715202004e-14
Complementarity.........:   1.0000052919175941e-11    1.0000052919175941e-11
Overall NLP error.......:   7.1548503566032280e-08    7.1548503566032280e-08

Number of objective function evaluations             = 13
Number of objective gradient evaluations             = 13
Number of equality constraint evaluations            = 13
Number of inequality constraint evaluations          = 13
Number of equality constraint Jacobian evaluations   = 13
Number of inequality constraint Jacobian evaluations = 13
Number of Lagrangian Hessian evaluations             = 12
Total CPU secs in IPOPT (w/o function evaluations)   =      0.008
Total CPU secs in NLP function evaluations           =      0.000

EXIT: Optimal Solution Found.

_______________________________________________________________________________________

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
Ipopt is released as open source code under the Common Public License (CPL).
******************************************************************************

Starting derivative checker.

grad_f[          0] =  4.0000000050599027e+00    ~  3.9999999753799460e+00  [ 7.420e-09]
jac_g [    0,    0] =  1.0000000030273490e+00 v  ~  9.9999999384498650e-01  [ 9.182e-09]
jac_g [    1,    0] =  2.0000000001550853e+00 v  ~  1.9999999876899730e+00  [ 6.233e-09]
grad_f[          1] =  1.0000000007033654e+00    ~  9.9999999307597087e-01  [ 7.627e-09]
jac_g [    0,    1] =  1.0000000022583335e+00 v  ~  9.9999999307597087e-01  [ 9.182e-09]
jac_g [    1,    1] =  2.0000000016931163e+00 v  ~  1.9999999861519417e+00  [ 7.771e-09]
grad_f[          2] =  2.0000000007033654e+00    ~  1.9999999847351217e+00  [ 7.984e-09]
jac_g [    0,    2] =  1.0000000015499235e+00 v  ~  9.9999999236756087e-01  [ 9.182e-09]
jac_g [    1,    2] =  2.0000000031099363e+00 v  ~  1.9999999847351217e+00  [ 9.187e-09]
grad_f[          3] =  3.0000000027116971e+00    ~  2.9999999798901191e+00  [ 7.607e-09]
jac_g [    0,    3] =  1.0000000024790690e+00 v  ~  9.9999999329670630e-01  [ 9.182e-09]
jac_g [    1,    3] =  2.0000000012516455e+00 v  ~  2.0000000754112546e+00  [ 3.708e-08]
obj_hess[    0,    0] =  2.0000000012516455e+00 v  ~  1.9999999876899730e+00  [ 6.781e-09]
obj_hess[    0,    1] =  1.0000000006258227e+00 v  ~  9.9999999384498650e-01  [ 6.781e-09]
obj_hess[    0,    2] =  1.0000000006258227e+00 v  ~  9.9999999384498650e-01  [ 6.781e-09]
obj_hess[    0,    3] =  4.0000000025566109e+00 v  ~  3.9999999753799460e+00  [ 6.794e-09]
obj_hess[    1,    0] =  1.0000000006258227e+00 v  ~  9.9999999307597087e-01  [ 7.550e-09]
obj_hess[    1,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
obj_hess[    1,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
obj_hess[    1,    3] =  1.0000000000775426e+00 v  ~  9.9999999307597087e-01  [ 7.002e-09]
obj_hess[    2,    0] =  1.0000000006258227e+00 v  ~  9.9999999236756087e-01  [ 8.258e-09]
obj_hess[    2,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
obj_hess[    2,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
obj_hess[    2,    3] =  1.0000000000775426e+00 v  ~  9.9999999236756087e-01  [ 7.710e-09]
obj_hess[    3,    0] =  4.0000000025566109e+00 v  ~  3.9999999731868252e+00  [ 7.342e-09]
obj_hess[    3,    1] =  1.0000000000775426e+00 v  ~  9.9999999329670630e-01  [ 6.781e-09]
obj_hess[    3,    2] =  1.0000000000775426e+00 v  ~  9.9999999329670630e-01  [ 6.781e-09]
obj_hess[    3,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
0-th constr_hess[    0,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
0-th constr_hess[    0,    1] =  1.0000000021807909e+00 v  ~  9.9999999384498650e-01  [ 8.336e-09]
0-th constr_hess[    0,    2] =  1.0000000014723809e+00 v  ~  9.9999999384498650e-01  [ 7.627e-09]
0-th constr_hess[    0,    3] =  1.0000000024015263e+00 v  ~  9.9999999384498650e-01  [ 8.557e-09]
0-th constr_hess[    1,    0] =  1.0000000021807909e+00 v  ~  9.9999999307597087e-01  [ 9.105e-09]
0-th constr_hess[    1,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
0-th constr_hess[    1,    2] =  1.0000000007033654e+00 v  ~  9.9999999307597087e-01  [ 7.627e-09]
0-th constr_hess[    1,    3] =  1.0000000016325108e+00 v  ~  9.9999999307597087e-01  [ 8.557e-09]
0-th constr_hess[    2,    0] =  1.0000000014723809e+00 v  ~  9.9999999236756087e-01  [ 9.105e-09]
0-th constr_hess[    2,    1] =  1.0000000007033654e+00 v  ~  9.9999999236756087e-01  [ 8.336e-09]
0-th constr_hess[    2,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
0-th constr_hess[    2,    3] =  1.0000000009241008e+00 v  ~  9.9999999236756087e-01  [ 8.557e-09]
0-th constr_hess[    3,    0] =  1.0000000024015263e+00 v  ~  9.9999999329670630e-01  [ 9.105e-09]
0-th constr_hess[    3,    1] =  1.0000000016325108e+00 v  ~  9.9999999329670630e-01  [ 8.336e-09]
0-th constr_hess[    3,    2] =  1.0000000009241008e+00 v  ~  9.9999999329670630e-01  [ 7.627e-09]
0-th constr_hess[    3,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    0,    0] =  2.0000000000000000e+00 v  ~  1.9999999876899730e+00  [ 6.155e-09]
1-th constr_hess[    0,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    0,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    0,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    1,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    1,    1] =  2.0000000000000000e+00 v  ~  1.9999999861519417e+00  [ 6.924e-09]
1-th constr_hess[    1,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    1,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    2,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    2,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    2,    2] =  2.0000000000000000e+00 v  ~  1.9999999847351217e+00  [ 7.632e-09]
1-th constr_hess[    2,    3] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    3,    0] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    3,    1] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    3,    2] =  0.0000000000000000e+00 v  ~  0.0000000000000000e+00  [ 0.000e+00]
1-th constr_hess[    3,    3] =  2.0000000000000000e+00 v  ~  1.9999999865934126e+00  [ 6.703e-09]

No errors detected by derivative checker.

Number of nonzeros in equality constraint Jacobian...:        4
Number of nonzeros in inequality constraint Jacobian.:        4
Number of nonzeros in Lagrangian Hessian.............:       10

Total number of variables............................:        4
variables with only lower bounds:        0
variables with lower and upper bounds:        4
variables with only upper bounds:        0
Total number of equality constraints.................:        1
Total number of inequality constraints...............:        1
inequality constraints with only lower bounds:        1
inequality constraints with lower and upper bounds:        0
inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
0  1.6109693e+01 1.12e+01 5.28e-01   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
1  1.7410406e+01 8.38e-01 2.25e+01  -0.3 7.97e-01    -  3.19e-01 1.00e+00f  1
2  1.8001613e+01 1.06e-02 4.96e+00  -0.3 5.60e-02   2.0 9.97e-01 1.00e+00h  1
3  1.7199482e+01 9.04e-02 4.24e-01  -1.0 9.91e-01    -  9.98e-01 1.00e+00f  1
4  1.6940955e+01 2.09e-01 4.58e-02  -1.4 2.88e-01    -  9.66e-01 1.00e+00h  1
5  1.7003411e+01 2.29e-02 8.42e-03  -2.9 7.03e-02    -  9.68e-01 1.00e+00h  1
6  1.7013974e+01 2.59e-04 8.65e-05  -4.5 6.22e-03    -  1.00e+00 1.00e+00h  1
7  1.7014017e+01 2.88e-07 2.18e-07 -10.3 1.43e-04    -  9.99e-01 1.00e+00h  1
8  1.7014017e+01 1.14e-13 2.49e-14 -11.0 1.04e-07    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 8

(scaled)                 (unscaled)
Objective...............:   1.7014017140224134e+01    1.7014017140224134e+01
Dual infeasibility......:   2.4926502758958318e-14    2.4926502758958318e-14
Constraint violation....:   2.8421709430404007e-14    2.8421709430404007e-14
Complementarity.........:   1.0023967333275299e-11    1.0023967333275299e-11
Overall NLP error.......:   1.0023967333275299e-11    1.0023967333275299e-11

Number of objective function evaluations             = 9
Number of objective gradient evaluations             = 9
Number of equality constraint evaluations            = 9
Number of inequality constraint evaluations          = 9
Number of equality constraint Jacobian evaluations   = 9
Number of inequality constraint Jacobian evaluations = 9
Number of Lagrangian Hessian evaluations             = 8
Total CPU secs in IPOPT (w/o function evaluations)   =      0.008
Total CPU secs in NLP function evaluations           =      0.000

EXIT: Optimal Solution Found.