Consider the
following model:
var
vX >= 0, <=
5 :=
2 ;
var vY >= 0, <= 5 := 1 ; s.t.
cXY: vX + 13 * vY >=
6;
minimize
oObj: ( vX - vY )^2
;
problem
bX:
oObj,
cXY, vX;
problem
bY:
oObj,
cXY, vY;
If I execute the
command "expand bX;" I get the error:
AMPL Version
20060626 (SunOS 5.9)
Error executing "expand" command (file dum.run, line 1, offset 0): expand
problem (other than expand Current) not yet implemented
By contrast, if I
execute two consecutive commands "problem bX;" followed by "expand
bX" I get the following:
AMPL Version
20060626 (SunOS 5.9)
minimize oObj: (vX - vY)^2; subject to cXY:
vX + 13*vY >= 6; Neither of these two
responses seem to me to be very appealing. The error is of course
not appealing, and this appears to be a defect because it is not stated that an
expand command must be preceded by a problem setting
command.
But moreover, in the
second output the variable vY appears in the expansion of problem
bX. Problem bX does not include variable vY (a "show bX" command
correctly returns "problem bX: oObj, cXY,
vX;"). I would expect the expansion of problem
bX to look like this:
AMPL Version
20060626 (SunOS 5.9)
minimize oObj: (vX - 1.0)^2; subject to cXY: vX >= -7; because vY is fixed
with respect to problem bX.
Thanks,
Ronald P. Menich
JDA Software, Inc.
1090 Northchase Parkway, Suite
300
Marietta, GA 30067
direct 770 701 3465; fax 770 424
0050
Proven Revenue Management Results
http://www.jda.com/solutions/revenue-management.html
Operations Research: The Science
of Better http://www.scienceofbetter.org/
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Regarding the syntax error, I'm probably a few laps behind on documenation, but the copy of "AMPL Syntax Update" I have (which came with ILOG AMPL CPLEX v. 7.0) explicitly states (p. 106) "[[At present, expand can be applied only to the current problem.]]" Presumably the use of "expand <problem name>" rather than just "expand" implies an intent to extend it to non-current problems in the future. As to the output, I think what AMPL should show is likely a matter for some debate. On the one hand, substituting the current value of vY (what you propose) is certainly consistent with what expand does to named parameters. On the other hand, the fact that vY is declared a variable strongly suggests that it is likely to change values, possibly before a run of bX (or between runs of bX); so expanding vY to its current value might be construed as misleading. (I'll grant that a named parameter can also change between runs, but I think a variable is more likely to change.) Note that if you solve bX (before solving bY), vY is fixed at 1 as intended. Perhaps a reasonable compromise might be to have two levels of expansion (say, 'expand' that substitutes only parameters and 'fullexpand' that also substitutes variables outside the model scope)? /Paul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
In reply to this post by Ronald Menich
The command
"expand" shows the instantiated ampl: problem
bX; ampl: expand
bX; minimize oObj:
(vX - vY)^2; subject to cXY:
vX + 13*vY >= 6; But when the model is sent
to the solver: ampl: solexpand
bX; minimize oObj:
(-1 + vX)^2; The constraint has
disappeared here because it has become a simple bound on vX and ampl: option
presolve 0; ampl: solexpand
bX; minimize oObj:
(-1 + vX)^2; subject to cXY:
vX >= -7; This is the output that you
were expecting. The inconsistent handling of "expand bX" is
perhaps more of a bug than a feature, however, so I will report it as something
to be investigated futher. Bob Fourer From: Consider the following model: var
vX >= 0, <=
5 :=
2 ; var
vY >= 0, <=
5
:= 1 ; s.t.
cXY: vX + 13 * vY >= 6; minimize
oObj: ( vX - vY )^2 ; problem
bX: oObj,
cXY, vX; problem
bY:
oObj,
cXY, vY; If I execute the command "expand bX;"
I get the error:
expand
problem (other than expand Current) not yet implemented By contrast, if I execute two consecutive commands
"problem bX;" followed by "expand
bX" I get the following:
subject to cXY: Neither of these two responses seem to me to be very
appealing. The error is of course not appealing, and this appears
to be a defect because it is not stated that an expand command must be preceded
by a problem setting command. But moreover, in the second output the variable vY appears
in the expansion of problem bX. Problem bX does not include
variable vY (a "show bX" command correctly returns "problem bX:
oObj, cXY, vX;"). I would expect the expansion of
problem bX to look like this:
subject to cXY: because vY is fixed with respect to problem bX. Thanks, Ronald P. Menich JDA Software, Inc. direct 770 701 3465; fax 770 424 0050 Proven Revenue Management Results http://www.jda.com/solutions/revenue-management.html Operations Research: The Science of Better http://www.scienceofbetter.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Thank you for the workaround, that
helps. From: Robert Fourer [mailto:[hidden email]] Sent: Thursday, February 07, 2008 12:18 PM To: [hidden email]; Ronald Menich Subject: RE: [AMPL 1597] Problems The command
"expand" shows the instantiated
ampl: problem bX;
ampl: expand bX;
minimize oObj:
(vX - vY)^2;
subject to cXY:
vX + 13*vY >= 6; But when the
model is sent to the solver:
ampl: solexpand bX;
minimize oObj:
(-1 + vX)^2; The constraint
has disappeared here because it has become a simple bound on vX and
ampl: option presolve
0; ampl: solexpand
bX;
minimize oObj:
(-1 + vX)^2;
subject to cXY:
vX >= -7; This is the
output that you were expecting. The inconsistent handling of "expand bX"
is perhaps more of a bug than a feature, however, so I will report it as
something to be investigated futher. Bob
Fourer From:
Consider the following
model: var
vX >= 0, <=
5 :=
2 ; var
vY >= 0, <=
5
:= 1
; s.t.
cXY: vX + 13 * vY >=
6; minimize
oObj: ( vX - vY )^2
; problem
bX:
oObj,
cXY,
vX; problem
bY:
oObj,
cXY, vY; If I execute the command "expand
bX;" I get the error:
expand problem (other than expand Current) not yet
implemented By contrast, if I execute two
consecutive commands "problem bX;" followed by "expand
bX" I get the following:
subject to
cXY: Neither of these two responses seem
to me to be very appealing. The error is of course not appealing,
and this appears to be a defect because it is not stated that an expand command
must be preceded by a problem setting
command. But moreover, in the second output
the variable vY appears in the expansion of problem bX. Problem bX
does not include variable vY (a "show bX" command correctly returns "problem bX:
oObj, cXY, vX;"). I would expect the expansion of problem bX
to look like this:
subject to
cXY: because vY is fixed with respect to
problem bX. Thanks, Ronald P.
Menich JDA Software,
Inc. direct 770 701 3465; fax 770
424 0050 Proven Revenue Management Results http://www.jda.com/solutions/revenue-management.html Operations Research: The
Science of Better http://www.scienceofbetter.org/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
Free forum by Nabble | Edit this page |