[Ipopt] AMPL/Iopt weirdness
Michel Bouard
mbouard at gmail.com
Mon Sep 5 09:08:29 EDT 2011
> Date: Wed, 31 Aug 2011 17:53:32 -0300
> From: Horand Gassmann <Horand.Gassmann at Dal.Ca>
> Subject: [Ipopt] AMPL/Iopt weirdness
> To: ipopt at list.coin-or.org
> Message-ID: <20110831175332.35301z9qhefhv6f4 at wm1.dal.ca>
> Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes";
> format="flowed"
>
> I have two versions of an AMPL model for a Rosenbrock-type function.
>
> The first AMPL file looks like this:
>
> param scale = 100.0;
>
>
>
> var x{0..3} >=0, <=10;
>
>
>
> minimize objective: 5.01 + (1-x[0]**2)**2
>
> + scale* (x[0]-x[1]**2)**2
>
> + scale**2*(x[1]-x[2]**2)**2
>
> + scale**3*(x[2]-x[3]**2)**2;
>
> and in the second one I replaced the bounds by explicit constraints:
>
> param scale = 100.0;
>
> param lbl = 0.0;
>
> param ubl = 10.0;
>
>
>
> var x{0..3};
>
>
>
> minimize objective: 5.01 + (1-x[0]**2)**2
>
> + scale* (x[0]-x[1]**2)**2
>
> + scale**2*(x[1]-x[2]**2)**2
>
> + scale**3*(x[2]-x[3]**2)**2;
>
>
>
> subject to boxL{i in 0..3}: lbl <= x[i] ;
>
> subject to boxU{i in 0..3}: ubl >= x[i] ;
>
>
> I solve each version in two ways: calling Ipopt from AMPL, and using
> AMPL to write the .nl file (in ASCII form) and then calling Ipopt as a
> standalone.
>
> What I do not understand is the output that is generated. I end up
> with the same optimal solution (objective value 5.01), but I get there
> via different paths! The version with the bounds takes 136 iterations
> either way, as does the version with the explicit constraints if I
> start it from AMPL. But if I write out the second model to a .nl file
> and read that into Ipopt at the command line,the problem solves in 11
> iterations. I do not understand how that can be. The executable is the
> same, and the .nl file is the same (I am working under Ubuntu 11.04,
> which supports IEEE floating point --- right?) So what is different?
>
> Any ideas?
>
> Thanks
>
> gus
I wrote your model on my machine and the difference in iterations is explained
by the fact that Ipopt starts from the solution in the second case. In your second
.nl file, the initial point is the solution of the problem because there is certainly
a command after the "solve;" command in your .mod file. This behavior is explained in
the AMPL command help (ampl -o?):
-ostuff ==> execute "write stuff;" at end of last command-line file
if "solve;" would first write a .nl file.
Instead of the command "ampl -o", I suggest you to use the command "write stuff;"
("writeg stuff;" for ASCII) in your .mod file before the command "solve;" to create
a .nl file.
Michel
More information about the Ipopt
mailing list