[Coin-ipopt] Re: explain-my question

Andreas Waechter andreasw at watson.ibm.com
Fri Mar 31 15:27:55 EST 2006


Hi,

Just to follow up on this:

if I understand you question correctly, you want to use the matlab 
interface for (the Fortran version of) Ipopt.

Steinar Hauan and Clas Michalik, the developers of the matlab interface 
included already an option to estimate the first and even second 
derivatives by finite differences (see 
http://www.andrew.cmu.edu/user/steinhau/Research/mex/ipopt.txt and look at 
the possibility go give 'fd' to the arguments 3-5), so you wouldn't have 
to implement such an estimation procedure by yourself.  They also provide 
the option to use some automatic differential package, but this might not 
be an option for you.

As Carl pointed out, you need to provide at least the first derivatives, 
and Ipopt has an option to esimate the second derivatives (using a 
quasi-Newton approach).  This is the IQUASI option for the Fortran Ipopt 
(as described in the mex interface documentation).

I have no practical experience with matlab interface, so I don't have 
really an idea how well the approximation of the derivatives by finite 
diferences works.  As Carl and Damien mentioned in their messsages, if 
the computation of the objective function is done by some other iterative 
method, it is important that the resulting function is relatively smooth, 
i.e., doens't have mayor jumps or kinks, because otherwise Ipopt might get 
stuck at non-differentiable points.  It is also crutial to carefully adapt 
the tolerances for the computation of the objective function, which have 
to be balanced between sufficient accuracy and reasonable computation 
time.  Needless to say, estimation of first derivatives by finite 
differences is costly, since it will require a lot of objective function 
evaluations.  Also, you probably want to use a less tight tolerance for 
Ipopt's convergence criterion than the default, since the inaccuracy of 
the objective function evaluation and the error in the first derivative 
approximation will probably not allow you to obtain a very accurate 
solution.

If you already have the matlab interface for Ipopt working, I would just 
give it a try to use the included finite difference approximation of the 
mex interface together with a quasi-Newton option for Ipopt, and see how 
that goes.

In either case, it would be nice if you could let us know your experience 
with it.

Best regards,

Andreas

On Fri, 31 Mar 2006, Carl Damon Laird wrote:

> This kind of problem arises whenever someone has existing simulation code for 
> all or part of a model and they want to use this code in optimization. This 
> can be done, but you are likely going to have to approximate the derivatives 
> of the objective function (or more precisely, the derivatives of the y's with 
> respect to the x's - then use chain rule for df/dx).
>
> If your subroutine converting from x to y is indeed iterative, then you will 
> need to be very careful with convergence tolerances inside the subroutine and 
> Ipopt.
>
> Cheers,
>
> Carl.
>
> On Fri, 31 Mar 2006, zhangwen wrote:
>
>> Hi, Carl,
>>    Thank you for your replying for my question!
>>    I mean, if "x=(x_1,...,x_n)' " are the n variables of the NLP problem. 
>> The objective function has the form "f=f(y_1,...,y_n)", where 
>> "y=(y_1,...,y_n)' " and "y" can be got from the subroutine/sub-function 
>> "y=subfun(x)". Here, the objective function "f" has a unique form such as 
>> "f=y_1*y_1+...+y_n*y_n", but f can't be expressed directly by the vector x. 
>> I can get y through the subfunction 'subfun', but all the variables 
>> x_1,...,x_n are unknown at the beginning. So, the objective function must 
>> include another function "subfun", of which the variables are actually the 
>> unknowns of NLP. That may be my problem. Thanks.
>>> I am not sure what you mean by "get the objective function through another
>>> iteration". If your objective function is a particular subroutine, then it
>>> is certainly possible to use the Fortran interface (or Matlab if it is a
>>> Matlab subroutine) to define the problem. If you do not know the form of
>>> the objective function however, you will need to find some way to estimate
>>> the derivatives (at least first derivatives). This might mean using
>>> automatic differentiation or finite difference approximations.
>>> 
>>> Hope this helps,
>>> 
>>> Carl.
>>> 
>> Best Regards,
>> W. Zhang
>> 
>> 
>> 
> _______________________________________________
> Coin-ipopt mailing list
> Coin-ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-ipopt
>



More information about the Coin-ipopt mailing list