[Ipopt] question about nele_jac/nele_hess

Stefan Vigerske svigerske at gams.com
Mon Feb 22 02:32:19 EST 2021


Hi,

when sparsity pattern are requested (iRow,jCol), then these should be 
provided independent of a specific point. So you need to give all 
elements that can be non-zero at some point (within variable bounds).
Note that iRow and jCol only need to be specified once and you cannot 
set or change them evaluated at a specific point.

When values of Jacobian or Hessian are requested (values), then you 
should also specify zero values explicitly. You cannot assume that the 
values array has been initialized to be all-0. At least that's what I 
get from a quick look at TNLPAdapter.cpp, which is the place that calls 
these functions.

Stefan

On 2/16/21 10:15 PM, Ivo Stefanov wrote:
> Hello,
>    I am sorry if this has been asked before (I was not able to find it). I am using IpOpt to solve a relatively simple (yet sometimes a bit large) problem and I am sometimes not able to determine in advance the exact number of non-zero variables.  I can come up with the number of all positions that may at some point be non-zero, but depending on the value of x the actual number may vary.  Because of this I was wondering what the correct implementation of
> eval_jac_g and
> eval_h would be in such case - is it safe to populate iRow/jCol/values only up to the current non-zero count ?
>    For example, in
> get_nlp_info I provide the number of cells that can be non-zero at some point - for example, 100 000. Let's say that at the initial point they are all filled, so first iteration is fine.  Then, I get a value of x (say, second iteration) for which actually only 90 000 of those are non-zero, the others are 0 for this particular vector - should I just fill iRow/jCol/values up to index 90 000 or should I do something extra with the indices 90 0001 - 100 000 to clean up from the previous iteration?
>    
>    Thanks you very much for your help!
> 
> 
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/ipopt
> 



More information about the Ipopt mailing list