[Bonmin] Re: Integral function with Bonmin in AMPL

Roy Chen ytboy0208 at gmail.com
Sat Mar 3 02:11:17 EST 2007


Dear Pierre
I tried function ginv() with bonmin, using the example you mentioned in
funcadd.c. The followings are two experiments I did:
Experiment 1:
ampl: function ginv(Reals);
ampl: display {i in -3...3} ginv(i);
ginv(i) [*] :=
-3  -0.333333
-2  -0.5
-1  -1
 0   0
;
Experiment 2:
ampl: reset;
ampl: function ginv(Reals);
ampl: var x;
ampl: minimize Z:x*x+x+1+ginv(x);
ampl: subject to cons:x>=0.8;
ampl: option solver bonmin;
ampl: solve;
bonmin:
Cannot load library
/home/chen11q/AMPL_Learning/ampl_external_function/ASL/solvers/funclink/amplfunc.dll:
/home/chen11q/AMPL_Learning/ampl_external_function/ASL/solvers/funclink/amplfunc.dll:
cannot open shared object file: No such file or directory
function ginv not available
user-defined function not available
exit code 255
<BREAK>
What I do not quite understand is: as you said in this example, the first
and second derivatives of the function ginv() has been defined properly in C
code, then why couldn't gin()still be used with Bonmin in AMPL? I am just
trying to run this small example to make sure that once I can successfully
write the first and second derivative of the external function, it will work
properly with Bonmin as the solver in ampl.

Thanks a lot for your time.

Roy



On 3/2/07, Pierre Bonami <pierre.bonami at gmail.com> wrote:
>
> Dear Roy, I am not sure that I understand your question. Maybe I was not
> clear enough. You have to provide the computation of first and second order
> derivatives of the function you are adding. All the computation actually
> take place in the same function.
> In the funclink directory there is an example:
>
>
>
>
> static real
> ginv(arglist *al) /* generalized inverse of a single argument */
> {
> real x = al->ra[0];
> x = x ? 1./x : 0.;
> if (al->derivs) {
> *al->derivs = -x*x;
> if (al->hes)
> *al->hes = -2.*x * *al->derivs;
> }
> return x;
> }
>
>
>
> you can see that first order derivative is put in al->derivs, and second
> order in al->hes. You should refer to the AMPL documentation to see where
> derivatives have to be provided.
> I used such user defined functions within Bonmin without problems, so I
> would think that it is possible. If you want to send me the files (ampl
> model and code to compile the funclink.dll), I can try to have a look and
> see if I can get it to work.
> Best regards,
> Pierre
>
>
>
>  On Mar 2, 2007, at 8:22 PM, Roy Chen wrote:
>
>  Dear Pierre
>
> I asked you about using Bonmin to solve my problem with the integration in
> objective two months ago, the following is the advice you gave to me at that
> time.
> "For your problem of integration. In theory Bonmin should be able to do
> something with your problem if you provide functions for computing first and
> second order derivatives for your integral. I think that the most simple way
> is to import directly the function into ampl (see for example funclink
> subdirectory in the ASL library and the readme file here
> http://www.netlib.org/ampl/solvers/funclink/README )."
> Now what I am still wondering is:
> Should I just provide functions for computing first and second orfer
> derivatives for my integral in AMPL user-defined external function instead
> of providing the AMPL external function to calculate the exact integral
> function value given some variables defined in AMPL as the input of integral
> function?
> Best regards,
>
> Roy
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/bonmin/attachments/20070303/48c457d5/attachment.html


More information about the Bonmin mailing list