<div>Dear Andreas</div>
<div>I tried function ginv() with bonmin, which is an example in funcadd.c. The followings are two experiments I did:</div>
<div><font color="#3333ff">Experiment 1:</font></div>
<div><font color="#ff0000">ampl: function ginv(Reals);<br>ampl: display {i in -3...3} ginv(i);<br>ginv(i) [*] :=<br>-3 -0.333333<br>-2 -0.5<br>-1 -1<br> 0 0<br>;<br></font><font color="#3333ff">Experiment 2:</font></div>
<div><font color="#ff6600">ampl: reset;<br>ampl: function ginv(Reals);<br>ampl: var x;<br>ampl: minimize Z:x*x+x+1+ginv(x);<br>ampl: subject to cons:x>=0.8;<br>ampl: option solver bonmin;<br>ampl: solve;<br>bonmin: <br>
Cannot load library /home/chen11q/AMPL_Learning/ampl_external_function/ASL/solvers/funclink/amplfunc.dll:<br>/home/chen11q/AMPL_Learning/ampl_external_function/ASL/solvers/funclink/amplfunc.dll: cannot open shared object file: No such file or directory
<br>function ginv not available<br>user-defined function not available<br>exit code 255<br><BREAK></font></div>
<div><font color="#ff6600"><font color="#000000">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.
</font></font></div>
<div> </div>
<div><font color="#ff6600"><font color="#000000">Thanks a lot for your time.</font></font></div><span class="sg">
<div> </div>
<div><font color="#ff6600"><font color="#000000">Roy</font></font></div></span><br><br>
<div><span class="gmail_quote">On 3/2/07, <b class="gmail_sendername">Roy Chen</b> <<a href="mailto:ytboy0208@gmail.com">ytboy0208@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>Hello, Andreas</div>
<div>I appreciate your timely and helpful response very much.</div>
<div>I am kind of confused with the situation now because of the following reasons:</div>
<div>The way I need to define one of those integral functions in my problem is like this:</div>
<div>Integral(var1,var2,var3), assume I need these three inputs to do the calculation.</div>
<div>In my ampl .mod file, I used this function like this:</div>
<div><font color="#ff0000">set k;</font></div>
<div><font color="#ff0000">sum{s in k} Integral(x[s],y[s],z[s])<font color="#000000"> + .....; # x[s] is decision variable, y[s] and z[s] are parameters defined in .dat file.</font></font></div>
<div><font color="#ff0000"><font color="#000000">The coded Integral() function will give you the value give those three inputs.</font></font></div>
<div><font color="#ff0000"><font color="#000000">My question is:</font></font></div>
<div><font color="#ff0000"><font color="#000000">What are first and second order direvatives for in AMPL modeling? </font></font></div>
<div><font color="#ff0000"><font color="#000000">What kind of format you code the first and second order direvatives for Bonmin? </font></font></div>
<div><font color="#ff0000"><font color="#000000">How Bonmin can know and use the first and second orfer direvatives coded in AMPL external function?</font></font></div>
<div><font color="#ff0000"><font color="#000000">Again, if there could be a small example to illustrate this idea, that's will be better, I think.</font></font></div>
<div><font color="#ff0000"><font color="#000000">Very appreciate your time.</font></font></div>
<div><font color="#ff0000"><font color="#000000">Best</font></font></div><span class="sg">
<div><font color="#ff0000"><font color="#000000">Roy</font></font></div>
<div><br><br> </div></span>
<div><span class="q"><span class="gmail_quote">On 3/2/07, <b class="gmail_sendername">Andreas Waechter</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:andreasw@watson.ibm.com" target="_blank">
andreasw@watson.ibm.com</a>> wrote:</span> </span>
<div><span class="e" id="q_111157a60e785a42_4">
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Roy,<br><br>> Could you actually provide one example which uses automatic differentiation<br>> to give the first and second direvatives with ampl external function?
<br><br>I'm not sure, part of the code was not written by me and I'm not sure if I<br>can give it away.<br><br>> Another question coming into my mind is:<br>> Does that mean I don't need code to calculate the value of the integration
<br>> function, instead, I just need to code to calculate the first and second<br>> direvatives?<br><br>No, we still also need the values.<br><br>However, if your function (including the integral) is such that the first
<br>derivative is some analytic function without the integral, you could just<br>code the first derivatives using that analytic expression, from which you<br>could also easily the second derivative (as the first derivative of that
<br>other function).<br><br>> Again, if you can give me the example you mentioned in your email, I would<br>> appreciate it very much.<br><br>Given what I wrote in the last paragraph, let me know if you still want me
<br>to look for an example with ADOL-C.<br><br>Cheers,<br><br>Andreas<br></blockquote></span></div></div><br></blockquote></div><br>