[AMPL 15220] Bug in computed variable

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 15220] Bug in computed variable

picojeff
I encountered this error as part of a relatively large model (over 1000 lines), but I have reduced it to this minimal example.  When the result is found, two variables which are supposed to be equal differ (one is a computed variable equal to the other), and the reported objective value differs from the value returned by 'display obj'.  It doesn't matter which solver I use.

var x;
var y = x^2 - x;
var z = y;

minimize obj: z;

solve;

display solve_result_num, x, y, z, obj;

This produces the result
MINOS 5.51: optimal solution found.
2 iterations, objective -0.25
Nonlin evals: obj = 6, grad = 5.
solve_result_num = 0
x = 0.5
y = -0.25
z = -0.75
obj = -0.75

Note that y and z are different, and the reported objective -0.25 is different from obj -0.75.

If you change the definition of y to the equivalent
var y = x*(x-1);
then the problem  disappears. To me this suggests an error related to the parser inside AMPL -- I  won't pretend to understand the internals.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[AMPL 15226] Re: Bug in computed variable

picojeff
I thought to download a fresh copy of command-line ampl with a student license for my Windows 10 laptop.  I tried both 32-bit and 64-bit, because neither of them works correctly on this model: both snopt and minos report either that 0 is the optimal solution, or that the problem is unbounded, depending which variation of it I try with computed variables.  If I limit it to the single x variable and the objective explicit in terms of x, then they both work.  On the other hand loqo has no problem with the model as written, when I use a fresh download of 32- or 64-bit ampl command-line.  ampl is notably slow to start up with the new download: about 10 seconds to get going, compared to previously being essentially immediate.

Any idea if I need to do something beyond post here to alert the ampl dev team (aka Bob Fourer) to this problem?

 -Jeff

On Sunday, November 26, 2017 at 2:25:14 PM UTC-5, Jeff Snider wrote:
I encountered this error as part of a relatively large model (over 1000 lines), but I have reduced it to this minimal example.  When the result is found, two variables which are supposed to be equal differ (one is a computed variable equal to the other), and the reported objective value differs from the value returned by 'display obj'.  It doesn't matter which solver I use.

var x;
var y = x^2 - x;
var z = y;

minimize obj: z;

solve;

display solve_result_num, x, y, z, obj;

This produces the result
MINOS 5.51: optimal solution found.
2 iterations, objective -0.25
Nonlin evals: obj = 6, grad = 5.
solve_result_num = 0
x = 0.5
y = -0.25
z = -0.75
obj = -0.75

Note that y and z are different, and the reported objective -0.25 is different from obj -0.75.

If you change the definition of y to the equivalent
var y = x*(x-1);
then the problem  disappears. To me this suggests an error related to the parser inside AMPL -- I  won't pretend to understand the internals.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: [AMPL 15230] Re: Bug in computed variable

Robert Fourer-2
On this example with either "var y = x^2 - x;" or "var y = x*(x-1);" we see unboundedness or a wrong solution when applying MINOS or CPLEX.  Other nonlinear solvers (snopt, knitro, conopt, loqo) and linear-quadratic solvers (gurobi, xpress) find the correct optimal solution at x = 0.5, however.  This problem has been reported and there should be a fix for it soon.

We have seen problems with slow execution when Windows 10 is using all of the processor capacity for some system activity in the background.  However a check right now confirms that command-line AMPL starts up immediately as usual on a Windows 10 machine.  Be sure that you are using the links at http://ampl.com/try-ampl/download-a-free-demo/#windows for your downloads; the AMPL command "option version;" should show "AMPL Version 20171122".

Bob Fourer
[hidden email]

=======

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jeff Snider
Sent: Monday, November 27, 2017 9:32 PM
To: AMPL Modeling Language
Subject: [AMPL 15226] Re: Bug in computed variable

I thought to download a fresh copy of command-line ampl with a student license for my Windows 10 laptop.  I tried both 32-bit and 64-bit, because neither of them works correctly on this model: both snopt and minos report either that 0 is the optimal solution, or that the problem is unbounded, depending which variation of it I try with computed variables.  If I limit it to the single x variable and the objective explicit in terms of x, then they both work.  On the other hand loqo has no problem with the model as written, when I use a fresh download of 32- or 64-bit ampl command-line.  ampl is notably slow to start up with the new download: about 10 seconds to get going, compared to previously being essentially immediate.

Any idea if I need to do something beyond post here to alert the ampl dev team (aka Bob Fourer) to this problem?

=======

On Sunday, November 26, 2017 at 2:25:14 PM UTC-5, Jeff Snider wrote:
I encountered this error as part of a relatively large model (over 1000 lines), but I have reduced it to this minimal example.  When the result is found, two variables which are supposed to be equal differ (one is a computed variable equal to the other), and the reported objective value differs from the value returned by 'display obj'.  It doesn't matter which solver I use.

var x;
var y = x^2 - x;
var z = y;

minimize obj: z;

solve;

display solve_result_num, x, y, z, obj;

This produces the result

MINOS 5.51: optimal solution found.
2 iterations, objective -0.25
Nonlin evals: obj = 6, grad = 5.
solve_result_num = 0
x = 0.5
y = -0.25
z = -0.75
obj = -0.75

Note that y and z are different, and the reported objective -0.25 is different from obj -0.75.

If you change the definition of y to the equivalent
var y = x*(x-1);
then the problem  disappears. To me this suggests an error related to the parser inside AMPL -- I  won't pretend to understand the internals.


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 15235] Re: Bug in computed variable

picojeff
Thank you, Bob!  Please follow up when the problem has been fixed.

I was able to sort out the "slow start" issue. I ensured I have the latest download, and it did take a long time to start.  Always the first time, but the second time right away with the same solver it's immediate.  But change the solver and it suffers the long wait again.  Looking at the active processes, I saw it was Symantec consuming CPU during the delay.  I wound my way around to adding ampl.exe as a trusted piece of software on my computer so it doesn't get rescanned every single time it starts -- and voila, ampl is quick as ever again.  I don't know much of anything about Symantec, maybe it would eventually get around to scanning the entire drive and labeling that executable as safe, or maybe you could work with them to register the file image in some way as legitimate.  My slowdown problem is solved, so I'm content.

Thank you for your help, I do look forward to an update that fixes the unboundedness/wrong solution issue.

 -Jeff


On Tuesday, November 28, 2017 at 1:17:25 PM UTC-5, Robert Fourer wrote:
On this example with either "var y = x^2 - x;" or "var y = x*(x-1);" we see unboundedness or a wrong solution when applying MINOS or CPLEX.  Other nonlinear solvers (snopt, knitro, conopt, loqo) and linear-quadratic solvers (gurobi, xpress) find the correct optimal solution at x = 0.5, however.  This problem has been reported and there should be a fix for it soon.

We have seen problems with slow execution when Windows 10 is using all of the processor capacity for some system activity in the background.  However a check right now confirms that command-line AMPL starts up immediately as usual on a Windows 10 machine.  Be sure that you are using the links at <a href="http://ampl.com/try-ampl/download-a-free-demo/#windows" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fampl.com%2Ftry-ampl%2Fdownload-a-free-demo%2F%23windows\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGGsF-Ch8X1CRFDNbFm2unu4L8wKg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fampl.com%2Ftry-ampl%2Fdownload-a-free-demo%2F%23windows\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGGsF-Ch8X1CRFDNbFm2unu4L8wKg&#39;;return true;">http://ampl.com/try-ampl/download-a-free-demo/#windows for your downloads; the AMPL command "option version;" should show "AMPL Version 20171122".

Bob Fourer
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Bkg19yGtAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">am...@...

=======

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Bkg19yGtAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">am...@... [mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Bkg19yGtAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">am...@...] On Behalf Of Jeff Snider
Sent: Monday, November 27, 2017 9:32 PM
To: AMPL Modeling Language
Subject: [AMPL 15226] Re: Bug in computed variable

I thought to download a fresh copy of command-line ampl with a student license for my Windows 10 laptop.  I tried both 32-bit and 64-bit, because neither of them works correctly on this model: both snopt and minos report either that 0 is the optimal solution, or that the problem is unbounded, depending which variation of it I try with computed variables.  If I limit it to the single x variable and the objective explicit in terms of x, then they both work.  On the other hand loqo has no problem with the model as written, when I use a fresh download of 32- or 64-bit ampl command-line.  ampl is notably slow to start up with the new download: about 10 seconds to get going, compared to previously being essentially immediate.

Any idea if I need to do something beyond post here to alert the ampl dev team (aka Bob Fourer) to this problem?

=======

On Sunday, November 26, 2017 at 2:25:14 PM UTC-5, Jeff Snider wrote:
I encountered this error as part of a relatively large model (over 1000 lines), but I have reduced it to this minimal example.  When the result is found, two variables which are supposed to be equal differ (one is a computed variable equal to the other), and the reported objective value differs from the value returned by 'display obj'.  It doesn't matter which solver I use.

var x;
var y = x^2 - x;
var z = y;

minimize obj: z;

solve;

display solve_result_num, x, y, z, obj;

This produces the result

MINOS 5.51: optimal solution found.
2 iterations, objective -0.25
Nonlin evals: obj = 6, grad = 5.
solve_result_num = 0
x = 0.5
y = -0.25
z = -0.75
obj = -0.75

Note that y and z are different, and the reported objective -0.25 is different from obj -0.75.

If you change the definition of y to the equivalent
var y = x*(x-1);
then the problem  disappears. To me this suggests an error related to the parser inside AMPL -- I  won't pretend to understand the internals.


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: [AMPL 15266] Re: Bug in computed variable

Robert Fourer-2
The relevant solvers have now been updated to fix this problem, which appeared only in certain cases where the objective had the form "minimize obj v;" and v was a variable defined in terms of other variables.  All of our currently available downloads incorporate this fix.

Bob Fourer
[hidden email]


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 15273] Re: Bug in computed variable

picojeff
I have confirmed it works as expected.  Thank you for the prompt investigation and fix of the bug!

Best,

 -Jeff

On Friday, December 1, 2017 at 2:57:38 PM UTC-5, Robert Fourer wrote:
The relevant solvers have now been updated to fix this problem, which appeared only in certain cases where the objective had the form "minimize obj v;" and v was a variable defined in terms of other variables.  All of our currently available downloads incorporate this fix.

Bob Fourer
<a href="javascript:" target="_blank" gdf-obfuscated-mailto="R0EBGCVkAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">am...@...


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.