<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<p>I've just a little problem using the function optim.
<br>Here is the function I want to optimize :
<p>test_function(x){(exp(-0.06751 + 0.25473*((x[1]-350)/150) + 0.04455*((x[2]-40)/20)
+ 0.09399*((x[3]-400)/100) - 0.17238*((x[4]-250)/50)-
<br>0.45984*((x[5]-550)/150)-0.39508*((x[1]-350)/150)* ((x[1]-350)/150)
- 0.05116*((x[2]-40)/20)* ((x[2]-40)/20) -
<br>0.27735*((x[3]-400)/100)*((x[3]-400)/100) - 0.12902*((x[4]-250)/50)*
((x[4]-250)/50)-1.07812*((x[5]-550)/150)* ((x[5]-550)/150) -
<br>0.14650*((x[1]-350)/150)*((x[2]-40)/20) - 0.39647*((x[1]-350)/150)*
((x[3]-400)/100) + 0.09800*((x[1]-350)/150)* ((x[4]-250)/50) +
<br>1.01607*((x[1]-350)/150)*((x[5]-550)/150) -0.04202*((x[2]-40)/20)*
((x[3]-400)/100) + 0.05057*((x[2]-40)/20)* ((x[4]-250)/50) +
<br>0.17933*((x[2]-40)/20)*((x[5]-550)/150) + 0.10944*((x[3]-400)/100)*
((x[4]-250)/50) + 0.62105*((x[3]-400)/100)* ((x[5]-550)/150) -
<br>0.22426*((x[4]-250)/50)*((x[5]-550)/150))/219741978624 )}
<p>Then I run the following command, and I get a pretty good result (I
know approximatively the theoritical maximum)
<p> optim(c(200,60,500,300,700),test,control=list(fnscale=-1))$par
<br>[1] 398.17520 31.34863 372.17182 217.30874 533.49458
<p>Fortunately, all the optimal values fall in their range of possible
value. But to be rigourous, I should perform a box-constrained optimization.
<br>Then, I do so with the following command (in fixing the lower
and upper args and not):
<p> optim(c(200,60,500,300,700),test,control=list(fnscale=-1),method="L-BFGS-B",lower=c(200,20,300,200,400),upper=c(500,60,500,300,700))$par
<br>[1] 200 60 500 300 700
<p> optim(c(200,60,500,300,700),test,control=list(fnscale=-1),method="L-BFGS-B")$par
<br>[1] 200.00000 60.00007 500.00000 300.00000 700.00000
<p>Here the result I get is wrong, and in fact it is more or less the initial
guess I 've set.
<p>Can someone explain me what is going wrong with the method "L-BFGS-B"
<p>Thanks in advance
<p>Isabelle Zabalza-Mezghani
<br>
<br>
<pre>--
Isabelle Zabalza-Mezghani Tel : 01 47 52 61 99
Institut Français du Pétrole E-mail : isabelle.zabalza-mezghani@ifp.fr
1-4 Av. Bois Preau - Bat Lauriers
92852 Rueil Malmaison Cedex, France</pre>
</html>