# [Ipopt] Ipopt Digest, Vol 38, Issue 14

ZhangWeizhong greatzwz at hotmail.com
Wed Feb 27 16:44:53 EST 2008

Hi, anyone can help me about my problem?

For eval_jac_g(Index n, const Number* x, bool new_x, Index m, Index nele_jac, Index* iRow, Index *jCol, number* values ).
In IPOPT manual p21
" If iRow and jCol arguments are not NULL, then IPOPT wants your to fill in the sparsity structure of the Jacobian(the row and column indices only). At this time, the x argument and the values argument will be NULL"

I do not understand the following two questions according to the manual p21.
How can x be null at any situation? The values are the nonzero elements in the jacobian of the constraint functions, how can be null when we specify the locations of the nonzero elements?

Thank you.

The attachment is the results from my running program.

I used "derivative checker" to run my program, the result is in the following:
"......
* jac_g [   96,  151] =  0.0000000000000000e+00    ~  1.8756734988301105e+03  [ 1.000e+00]
* jac_g [   98,  151] =  0.0000000000000000e+00    ~  1.9164490083767305e+03  [ 1.000e+00]
* jac_g [  100,  151] =  0.0000000000000000e+00    ~  1.9572245150811796e+03  [ 1.000e+00]

Derivative checker detected 935 error(s).

Number of nonzeros in equality constraint Jacobian...:     1000
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        0

*** Error from MA27AD *** IFLAG = 1 IERROR = 958
The index of a matrix is out of range.
Please check your implementation of the Jabobian and Hessian matrices.Exception of type: FATAL_ERROR_IN_LINEAR_SOLVER in file "IpStdAugSystemSolver.cpp" at line 219:
Exception message: A fatal error occured in the linear solver.

EXIT: Some uncaught Ipopt exception encountered.

*** The problem FAILED!"

By valgrind:
==20844== 128199 errors in context 40 of 40:
==20844== Conditional jump or move depends on uninitialised value(s)

----------------------------------------
> From: ipopt-request at list.coin-or.org
> Subject: Ipopt Digest, Vol 38, Issue 14
> To: ipopt at list.coin-or.org
> Date: Wed, 27 Feb 2008 12:00:02 -0500
>
> Send Ipopt mailing list submissions to
> 	ipopt at list.coin-or.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://list.coin-or.org/mailman/listinfo/ipopt
> or, via email, send a message with subject or body 'help' to
> 	ipopt-request at list.coin-or.org
>
> You can reach the person managing the list at
> 	ipopt-owner at list.coin-or.org
>
> than "Re: Contents of Ipopt digest..."
>
>
> Today's Topics:
>
>    1. Re: Ipopt Digest, Vol 38, Issue 8 (ZhangWeizhong)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 26 Feb 2008 16:51:45 -0500
> From: ZhangWeizhong
> Subject: Re: [Ipopt] Ipopt Digest, Vol 38, Issue 8
> To: ZhangWeizhong
> Cc: ipopt at list.coin-or.org
> Message-ID:
> Content-Type: text/plain; charset="gb2312"
>
>
> Hi,all:
>      Do we must supply "values" in eval_jac_g manually because IPOPT can not provide these automatically?
>      It seems that we do not have to provide the values(just index of the jacobian matrix is fine) to NAG.
>      The two differences between NAG and IPOPT now for me are
>       1. IPOPT needs to be provided with the derivative of the objective function, which is not required in NAG.
>       2. IPOPT needs to be provided with the jacobian of the constraints manually, in NAG, just the structure of the jacobian is needed.
>      Am I right for these?
>      Thank you.
>                                  Weizhong Zhang
>
>
> ----------------------------------------
>> From: greatzwz at hotmail.com
>> To: stefan at math.hu-berlin.de
>> Subject: RE: [Ipopt] Ipopt Digest, Vol 38, Issue 8
>> Date: Tue, 26 Feb 2008 15:21:14 -0500
>>
>>
>> Hi,Stefan:
>>     Thank you so much for your help.
>>      I think now I may know where the problem is.
>>      It is in
>>      eval_jac_g(Index n, const Number* x, bool new_x, Index m, Index nele_jac, Index* iRow, Index *jCol, Number* values).
>>
>>      I have supplied iRow, jCol, but  the values for the Jacobian of the constraints at the point x were not provided, I assumed it will be zero which is defined as the same as in NAG.
>>
>>     I will check that, thank you so much.
>>                                Weizhong Zhang
>>
>>
>>
>>
>>
>> ----------------------------------------
>>> Date: Tue, 26 Feb 2008 20:37:23 +0100
>>> From: stefan at math.hu-berlin.de
>>> To: ipopt at list.coin-or.org
>>> CC: greatzwz at hotmail.com
>>> Subject: Re: [Ipopt] Ipopt Digest, Vol 38, Issue 8
>>>
>>> Hi,
>>>
>>> ZhangWeizhong wrote:
>>>> hI, all:     Now the problem is " Invalid number in NLP function or derivative detected"     And  number of iteration is "0"    Can anyone give me any suggestions?
>>>
>>> Probably your code that computes function values and jacobian returns an
>>> invalid number.
>>> From the valgrind message you send I would guess that you might not set
>>> all values in the arrays that Ipopt provides you when it asks for a
>>> function or jacobian evaluation.
>>>
>>> You should make sure that you implemented the evaluation routines
>>> eval_f, eval_grad_f, eval_g, and eval_jac_g such that you return correct
>>> numbers in obj_value, grad_f, g, and values, repectively.
>>> E.g., in the eval_jac_g routine make sure that you have set all nele_jac
>>> entries of values and did not leave some out.
>>> Also you should not assume that values array is initialized with 0'th.
>>>
>>> Adding some printf's in your evaluation routines that tell which values
>>>
>>> (Andreas, you could make this error message a bit clearer by at least
>>> telling whether it was a function value or a gradient :-).)
>>>
>>> Best,
>>> Stefan
>>>
>>>
>>> --
>>> Stefan Vigerske
>>> Humboldt University Berlin, Numerical Mathematics
>>> http://www.math.hu-berlin.de/~stefan
>>
>> _________________________________________________________________
>> ????? MSN ??????????
>> http://mobile.msn.com.cn/
>
> _________________________________________________________________
> MSN?????????????????????
> http://im.live.cn/emoticons/?ID=18
>
>
> ------------------------------
>
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt
>
>
> End of Ipopt Digest, Vol 38, Issue 14
> *************************************

_________________________________________________________________
MSN圣诞礼物火热登场，免费发放中，快来领取吧！
http://im.live.cn/emoticons/?ID=18