[Bonmin] bonmin and ampl external function

Roy Chen ytboy0208 at gmail.com
Sat Mar 3 19:56:27 EST 2007


Dear Andreas
I tried function ginv() with bonmin, which is an example 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, Roy Chen <ytboy0208 at gmail.com> wrote:
>
> Hello, Andreas
> I appreciate your timely and helpful response very much.
> I am kind of confused with the situation now because of the following
> reasons:
> The way I need to define one of those integral functions in my problem is
> like this:
> Integral(var1,var2,var3), assume I need these three inputs to do the
> calculation.
> In my ampl .mod file, I used this function like this:
> set k;
> sum{s in k} Integral(x[s],y[s],z[s]) + .....; # x[s] is decision variable,
> y[s] and z[s] are parameters defined in .dat file.
> The coded Integral() function will give you the value give those three
> inputs.
> My question is:
> What are first and second order direvatives for in AMPL modeling?
> What kind of format you code the first and second order direvatives for
> Bonmin?
> How Bonmin can know and use the first and second orfer direvatives coded
> in AMPL external function?
> Again, if there could be a small example to illustrate this idea, that's
> will be better, I think.
> Very appreciate your time.
> Best
> Roy
>
>
>
> On 3/2/07, Andreas Waechter <andreasw at watson.ibm.com> wrote:
> >
> > Hi Roy,
> >
> > > Could you actually provide one example which uses automatic
> > differentiation
> > > to give the first and second direvatives with ampl external function?
> >
> > I'm not sure, part of the code was not written by me and I'm not sure if
> > I
> > can give it away.
> >
> > > Another question coming into my mind is:
> > > Does that mean I don't need code to calculate the value of the
> > integration
> > > function, instead, I just need to code to calculate the first and
> > second
> > > direvatives?
> >
> > No, we still also need the values.
> >
> > However, if your function (including the integral) is such that the
> > first
> > derivative is some analytic function without the integral, you could
> > just
> > code the first derivatives using that analytic expression, from which
> > you
> > could also easily the second derivative (as the first derivative of that
> >
> > other function).
> >
> > > Again, if you can give me the example you mentioned in your email, I
> > would
> > > appreciate it very much.
> >
> > Given what I wrote in the last paragraph, let me know if you still want
> > me
> > to look for an example with ADOL-C.
> >
> > Cheers,
> >
> > Andreas
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/bonmin/attachments/20070303/bd060874/attachment.html


More information about the Bonmin mailing list