*** AMPL change log and recent bug fixes *** Below is a summary of AMPL changes from 30 Nov. 1992, including a summary of recent bug fixes. For a much more complete list of bug fixes, send netlib@netlib.bell-labs.com the E-mail message send fixlog from ampl or otherwise obtain /netlib/ampl/fixlog, which is available at various URLs, such as ftp://netlib.bell-labs.com/netlib/ampl/fixlog.gz http://netlib.bell-labs.com/netlib/ampl/fixlog.gz http://www.netlib.org/ampl/fixlog Note that AMPL versions are strings of the form yyyymmdd, giving the date (year = yyyy, month = mm, date = dd) of the last change affecting the version. You can determine the version of your "ampl" program by issuing the AMPL command option version; or by invoking ampl with the -vv option. To see the version without executing ampl further, use the invocation ampl -vvq An up-to-date summary of AMPL changes and recent bug fixes is available by electronic mail: send netlib@netlib.bell-labs.com the E-mail message send changes from ampl Here is a summary of changes and recent bug repairs. Each block of changes is preceded by the version (yyyymmdd) in which the changes first appeared. 19921218: Add initial version of "show" command: "show;" or "show >filename;" lists all model entities. "show name;" or "show name >filename;" shows name's declaration if it has one, or else lists model entities of the kind indicated by the first letters of name: ch... ==> checks c... ==> constraints f... ==> functions o... ==> objectives p... ==> parameters s... ==> sets v... ==> variables 19930208: Add new option relax_integrality: option relax_integrality 1; causes "integer" and "binary" attributes of variables to be ignored (in solve and write commands). 19930303: Variable.lb3, .ub3 withdrawn. Add logic and option constraint_drop_tol (default 0) to deal with subtle presolve bug apparently caused by roundoff error: with $presolve > 1 and $var_bounds == 1 (the defaults), constraint bounds were very occasionally relaxed due to bounds only conveyed for $var_bounds > 1; this could increase the size of the feasible region, possibly making the problem unbounded. (Only known example: test problem MAROS from netlib's lp/data.) The fix involves keeping two sets of constraint bounds and switching between them based on $var_bounds. The constraint bounds for $var_bounds == 1 are only relaxed if roundoff poses no danger or the deduced bounds on the constraint body are sharper than the declared bounds by at least $constraint_drop_tol. (The default $constraint_drop_tol value 0 causes both sets of constraint bounds to be the same and gives the same behavior as before this change.) New constraint dot values: constraint.lbs1, .ubs1, lbs2, .ubs2 = versions of .lbs, .ubs corresponding to $var_bounds <= 1 or > 1, respectively. Constraint.lbs, .ubs still reflect the bounds sent to the solver. Delete warning about possibly incorrect dual values inferred for constraints eliminated by presolve: the inferred dual values are now believed to be correct in all cases. 19930315: Adjust presolve to use directed roundings on (some) IEEE-arithmetic machines. This sometimes leads to fewer surprises, such as an unbounded objective under default conditions with netlib's "maros from lp/data". 19930506: New command-line option -v2 merges stderr with stdout both for ampl and for subprocesses (whereas -ve just merges them for ampl). Allow negative precision with %f, with formatting as for the print command with $print_round < 0. 19930515: For entities with several subscripts, enforce the rule that literals must be quoted in the model. The first printing of thet AMPL book (middle of p. 252) erroneously shows some unquoted literals, which the AMPL translator should not have accepted. 19930615: Use stronger deduced variable bounds rather than declared variable bounds in deciding whether an integer variable is binary. 19930208): option presolve 0 ignored integrality. Adjust .nl files to convey (in their first 10 lines) counts of nonlinear integer variables and of nonlinear variables used in both constraints and objectives (nlvb). When nlvo > nlvc, arrange for the first nlvb variables to be the nonlinear variables common to both constraints and objectives (and the next nlvc - nlvb to be just in constraints). Adjust tables in "Hooking Your Solver to AMPL" to describe the new ordering of nonlinear variables; Postscript for this revised report is available by E-mail: ask netlib@netlib.bell-labs.com to send 93-10 from research/nam 19930805: New option presolve_inteps (default 1e-6) gives tolerance for rounding updated bounds on integer variables to integer values during presolve: if x.dlb and x.dub denote the new deduced lower and upper bounds on x, then for $presolve_inteps < 1, x.dlb := ceil(x.dlb - $presolve_inteps) and x.dub := floor(x.dub + $presolve_inteps). For $presolve_inteps >= 1, x.dlb := floor(x.dlb) and x.dub := ceil(x.dub). Adjust presolve complaints about impossible deduced bounds to take $presolve_eps into account. 19930914: New dot notation variable.dual applies to defined variables and gives the dual value for the defining equality constraint; this gives the partial derivative of the Lagrangian function (objective minus sum of duals times constraints) with respect to the defined variable. For other variables, variable.dual = 0. 19930928: --------------- FLOW OF CONTROL --------------- Several new commands permit conditional execution of and looping over lists of AMPL commands: if lexpr then cmd if lexpr then cmd else cmd # else matches nearest # available if for opt_name indexing cmd # dummies from indexing # may appear in cmd repeat opt_name opt_while { cmds } opt_while ; break opt_name ; continue opt_name ; cmd is either a single command (ending with ;) or { cmds } . cmds is a sequence of 0 or more commands . lexpr is a logical expression. opt_name is an optional loop name (which must be an unbound before the syntactic start of the loop), which goes out of scope after syntactic end of the loop. opt_while clauses are optional. If not null, opt_while has the form while lexpr or until lexpr If the optional loop name is not specified, break and continue apply to the immediately enclosing loop; otherwise they apply to the named loop; break terminates the loop, and continue causes its next iteration to begin (if permitted by the optional initial and final opt_while clauses of a repeat loop, or by the indexing of a for loop). Loops and if-then-else structures are treasured up until syntactically complete. Because else clauses are optional, AMPL must look ahead one token to check for their presence. At the outermost level, one must thus issue a null command (just a semicolon) or some other command or declaration to execute an outermost else-less "if ... then stmt". (In this regard, end-of-file implies an implicit null statement.) New options cmdprompt1 and cmdprompt2 (called prompt3 and prompt4 until 19930423) control prompting within the new flow-of-control commands. 19931005: New options $abs_boundtol, $rel_boundtol, and $show_boundtol are meant to help deduce correct dual values for constraints eliminated by presolve when the solver uses an interior-point algorithm and returns a solution with no bounds strictly holding. All three new options have default value 0, which gives the previous behavior. Suppose for some variable x that the solver sees the bounds lb <= x <= ub. The lower-bound constraint lb <= x is considered active (during reconstruction of dual values) if x <= lb or (x - lb < ub - x and x - lb <= max($abs_boundtol, |lb|*$rel_boundtol)), and similarly for the simple upper-bound constraint (x <= ub). Thus negative values of $abs_boundtol and $rel_boundtol behave like 0. The condition x - lb < ub - x ensures that x is closer to lb than half-way between lb and ub, ensuring that AMPL picks the more appropriate bound no matter how large $abs_boundtol and $rel_boundtol are. New option $show_boundtol works similarly to $show_stats, except that it delivers its messages when it is on (nonzero) and another dual-value computation occurs or (like $show_stats) when it is set to 1. It reports changes to $abs_boundtol and $rel_boundtol that would change the outcome of the dual computation, and is silent if the values of $abs_boundtol and $rel_boundtol do not matter. [$show_boundtol was called $show_boundstats until 20 Dec. 1993.] Have option redirections affect printing for "option show_stats 1;" and "option show_boundtol 1;". 19931029: Arrange for expressions involving primal and dual variable values to be recomputed when those values change. Example: set S := 1..6; var x; for{i in 2..4} { let x := i; display {j in S: j > x.val}; } formerly displayed the same set thrice; now each is distinct. Treat variable as variable.val, constraint as constraint.dual in indexing expressions for "fix", "unfix", "drop", "restore". New syntax for fix and unfix commands: an optional := expr may appear before the terminating semicolon, in which case the expression is assigned to the variable being fixed or unfixed (as though assigned by "let"). New option ampl_include gives a white-space separated list of directories in which to search for files in "include", "model", and "data" commands. In this list, a single period stands for the current directory. The default, '.' (a single period) gives the same behavior as heretofore. References to absolute file names (starting with "/" or, for MSDOS, one of "/", "\", or "x:", where x is any printing character) are not affected by $ampl_include . 19931113: Add "exit" as synonym for "quit". Recognize file names that start with "./" as file names relative to the current directory (and ignore $ampl_include for such file names). Arrange for all (?) expressions involving dot notation to be recomputed when the "dot value" changes. This involves adding "system" parameters _Solution_Count and _Initial_Guess_Count that, for debugging, may be referenced as params (but which may become invisible later). New option presolve_intepsmax (default 1e-5). The message "Setting $presolve_inteps >= nnn might help" is suppressed if nnn > $presolve_intepsmax. New option presolve_warnings (default 5) limits the number of warning messages printed during presolve; subsequent warning messages are suppressed, and the number of suppressed warnings (if positive) is reported at the end of presolve. When $presolve_warnings < |$eexit| (as is true by default), a subsequent "Ignoring solve command because presolve finds no feasible solution possible" may now appear even when presolve finds at least |$eexit| causes for infeasibility. 19931123: New option log_file (default ''). If $log_file is not '', then all lines read from stdin or written to stdout or stderr are copied to file $log_file. 19931203: New option bad_subscripts: ampl now discards invalid subscripts (read in a data section or assigned by "let"), and the accompanying error message now shows at most $bad_subscripts (default 3) invalid subscripts per entity (when there is more than one bad subscript). 19940303: Allow any option value that does not need to be quoted in a data section to be unquoted in option commands. Option values have always been printed without quotes when quotes can be elided in a data section, which made it impossible for $OPTIONS_INOUT to restore a value like a.b (or just ".", the default value for $ampl_include). Side effect: numeric option values are no longer rounded (to the shortest decimal string rounding to their numerical value rounded to the machine's arithmetic). For example, previously option foo 00123, goo '00123', zoo 1.234567890123456789; option foo, goo, zoo; printed option foo 123; option goo 00123; option zoo 1.2345678901234567; and now it prints option foo 00123; option goo 00123; option zoo 1.234567890123456789; 19940317: Allow "let S := {};" for sets S of arbitrary arity. 19930423: Allow any UTF character beyond the 7-bit ASCII characters to appear in names. New options dataprompt1 and dataprompt2 are analogous to prompt1 and prompt2, but for data mode; defaults 'ampl data:' and 'ampl data?'. Catch SIGINT ("break" or "del" key). When received, terminate reading all files except stdin, and abort compound commands. Stop if a second SIGINT arrives before a successful read on stdin. 19940429: Abort compound commands when solve returns a nonzero status (e.g., if the solver was stopped by a SIGINT). 19940506: Test whether variables fixed by the "fix" command lie within $presolve_eps of their declared ranges. 19940512: Arrange that set A default {expr}; ... let A := A; will keep A at its current value when the value of expr changes. Before A is assigned a value by let (or in a data section), the value of A will change when expr changes value. 19940807: Abort compound commands when solve or write says "Ignoring ...". Rerun presolve after changes to $presolve_eps. Allow inconsistencies up to $presolve_eps in declared variable and constraint lower and upper bounds. For inconsistent problems (detected by presolve), tell changes to $presolve_eps that would make AMPL ignore the inconsistencies, provided the larger $presolve_eps would be at most $presolve_epsmax (a new option with default 0). Report changes (below $presolve_epsmax) to $presolve_eps that would affect presolve results with $show_stats output. New options presolve_fixeps and presolve_fixepsmax (both with default 0): if presolve finds or deduces lower and upper bounds on a variable that differ by at most $presolve_fixeps, it fixes the variable at the average of the bound values. When changes below $presolve_fixepsmax to $presolve_fixeps would affect presolve, the $show_stats output reports these changes. Presolve now behaves as though $presolve_eps were max($presolve_eps, $presolve_fixeps): when $presolve_eps < $presolve_fixeps, variable bounds declared or deduced to be within $presolve_fixeps of each other in absolute value result in the variable being fixed at the average of the bounds. 19941003: Instantiate the entire index set of a for loop before starting execution of the loop, so the set of dummy indices for which the loop body is executed will be unaffected by assignments in the loop body. Example: set S default {1,2,3,4}; for {i in S} let S := S union {i + 4}; display S; # used to give 1..5; now gives 1..8 ## The loop could be stated more efficiently: ## let S := S union setof{i in S} i+4; Allow write and solve commands to proceed if only error messages about discarded subscripts appear. Disallow write and solve commands when presolve complains about inconsistent bounds; at the second attempt, show the least value of $presolve_eps that would allow the command to proceed. Apply $presolve_fixeps test to the declared bounds on each variable; although the description of $presolve_fixeps suggested that it should apply to the declared bounds, it did not. Change to behavior of "model filename" and "data filename", which are now commands: AMPL returns to model mode at the end of the file unless the file ends in the middle of data. Change to behavior of "data" and (hitherto undocumented) "commands" commands: when they appear within a compound command (i.e., the body of a loop or the then or else part of an if command, or simply in a sequence of commands enclosed in braces), they are now executed when the flow of control reaches them, instead of when the compound command is being read. In this case, if they do not specify a file, AMPL reads commands or data from the current input file until it encounters either an "end" command or the end of the current file. New option insertprompt (default '<%d>'), if nonnull, specifies an insert-prompt (in which %d is the current insert level, i.e., nesting of "data" and "commands" commands specifying files and appearing within a compound command) that immediately precedes the usual prompt for input from stdin. New single-step mode, details of which may change: option single_step n; where n is a positive integer, specifies that if the insert level is at most n, AMPL should behave as though "commands -;" were inserted before each command: it should read commands from stdin until "end" or eof (control-D on Unix systems). Some special commands may appear in this mode: command meaning step execute the next command skip skip the next command next if the next command is an if-then-else or looping command, execute the entire compound command before stopping again (unless the compound command itself specifies "commands -;") cont execute until the end of the end of all currently nested compound commands at the current insert level Allow "reset data" and "update data" commands to appear in compound commands. New option solver_msg (default 0; called omit_solmsg until 19941007): if set to 0, the solution message normally printed by the solve and solution commands is suppressed. 19941028: Omit (for now) recognition of @ (which once upon a time was a synonym for "cross" but now is reserved for future use). Adjust some insert-mode details; commands read by "include" or "model" are now at insert-level 0. New "read" command with syntax similar to the print command, except that the only simple or subscripted params, variables, and constraints (dual values) can be read. Optional input redirections are specified by < filename or < 'quoted_file_name' (before the read command's terminating semicolon). If no redirection is specified, values are read from the current input stream. To read from stdin, specify <- . Examples (reading from the current input steam): param p; read p; 4.2 display p; param ps symbolic; read ps; 'some funny text\ with a newline' display ps; param q{1..3}; read{i in 1..3} q[i]; 1.1 2.2 3.3 display q; param i; param j; param A{1..10,1..10}; param n; read n,{1..n}(i,j,A[i,j]); 3 2 4 2.4 3 5 3.5 4 7 4.7 display A; 19941127: Omit check for violation of declared bound constraints by variables fixed with the "fix" command. Abort compound commands (and the reading of files other than stdin) after "Ignoring solve command..." or "Ignoring write command...". 19950315: Provisional versions (subject to change as we gain experience and get feedback) of several extensions are now available. New reserved word "all", used in "drop all;", "fix all;", "restore all;", "unfix all;". Extension to "objective" command: "objective;" or "objective >filename;" prints commands establishing the current drop status of objectives. In particular, if one had previously said "objective foo[3];", "objective;" would print "objective foo[3];". Similarly, "drop;" or "drop >filename;" or "restore;" or "restore > filename;" prints commands establishing the current drop state of the constraints and objectives, and "fix;" or "fix >filename;" or "unfix;" or "unfix >filename;" prints commands establishing the current "fix" state of the variables. In these contexts, "drop" and "restore" are interchangeable, as are "fix" and "unfix". New "problem" declaration/command has three functions: declaring a new problem, making a previously declared problem current, and printing the name of the current problem (in the form of a problem command establishing the current problem). problem name optional_indexing optional_environ : itemlist ; declares a new problem and specifies the variables, constraints, and objectives that are in it. Other variables appearing in the specified constraints and objectives are fixed (but can be unfixed by the "unfix" command). The new problem becomes the current problem. Initially the current problem is "Initial". The "itemlist" in a problem declaration is a comma-separated list of possibly subscripted names of variables, constraints, and objectives, each optionally preceded by an indexing, as in {i in A} foo[i]. More generally, nested indexings similar to those allowed in function calls may be specified, as in {i in A} (foo[i], goo[i], {(i,j) in B} zoo[i,j]) The command problem name; makes name (a previously declared problem) current. And problem; or problem >filename; prints the current problem name (as "problem name;"). Drop/restore and fix/unfix commands apply only to the current problem. Variable values, like params, are global; just the fixed/unfixed status of a variable depends on the problem. Similarly, the drop/restore status of a constraint depends on the problem (as do reduced costs). The current problem does not restrict the "let" command. When a problem is declared, it can optionally specify an environment associated with the problem: the optional_environ phrase has the form environ envname to specify that the problem's initial environment is envname. Otherwise a new environment with the same name as the problem is created, and it inherits the then current environment (set of option values). In option commands, unadorned (conventional) option names refer to options in the current environment, and the notation envname.opname refers to $opname in environment envname. The new declaration environ envname optional_indexing; declares a environment envname (or a set of environments, subscripted by the indexing if specified). If there is no indexing, envname becomes the current environment for the current problem. New command environ optional_indexing envname := envname1; where envname and envname1 are optionally subscripted environment names, copies environment envname1 to envname. New "expand" command prints generated constraints and objectives (much as the linrc program does): expand [indexing] itemlist [>filename]; The itemlist can assume the same forms allowed in problem declarations. If it is empty, all non-dropped constraints and objectives are expanded. The variant solexpand [indexing] itemlist [>filename]; shows how constraints and objectives appear to the solver. It omits constraints and variables eliminated by presolve unless they are explicitly specified in the itemlist. Both the "expand" and "solexpand" commands permit variables to appear in the itemlist; for each, the commands show the linear coefficients of the variable in the relevant (non-dropped and, for solexpand, not eliminated by presolve) constraints and objectives, and indicates " + nonlinear" when the variable also participates nonlinearly in a constraint or objective. New options expand_precision and expand_round control printing of numbers by expand. By default they are currently printed to 6 significant figures (option expand_precision 6). Change to function calling conventions: symbolic arguments were formerly quoted (as though they were symbols in a data section); now they are stripped of quotes and the \ before a newline. Examples: print 'a b'; now prints a b rather than 'a b' New printf format %q prints with data-section quoting rules (omit quotes if omitting them is allowed in a data section); new printf format %Q always quotes strings. New concatenation operator & has precedence below all arithmetic operators and performs string concatenation. It accepts numeric operands and converts them to full-precision decimal strings (as though by printf format "%.g": recall that AMPL's "%.0g" gives full precision, rather than behaving like "%.1g"). Contexts (other than alias strings in declarations) that previously required literal strings now also accept an expression in parentheses. Expressions in commands may involve operands of the form $value (a $ followed by an environment name) and $environ.value (where environ is the possibly subscripted and previously declared name of an environment). $values may not be used in declarations. New builtin functions involved with strings: num('12.34') = 12.34 # convert string to number num('12.34x') = error # complain if stripping leading and # trailing white space doesn't yield # a valid decimal number num0('12.34x') = 12.34 # strip leading white space, and # interpret as much as possible as # a number, but never complain ichar('A') = 65 # Unicode value of the first character # in its argument string char(65) = 'A' # inverse of ichar length('abcd') = 4 # length of string substr('abcdef',3,2) = 'cd' # substring substr('abcdef',3) = 'cdef' # substring sprintf("stuff %.2f blah %g Blah %.g", 13/3, 2/7, 3/11) = 'stuff 4.33 blah 0.285714 Blah 0.2727272727272727' # general formatted conversion to string match('abcde','cd') = 3 # starting position of arg2 in arg1 match('abcde','xy') = 0 # or 0 if not found; arg2 can be a general # regular expression sub('abcdecd','cd','XYZ') = 'abXYZecd' # substitute arg3 for the first occurrence # of arg2 in arg1 gsub('abcdecd','cd','XYZ') = 'abXYZeXYZ' # substitute arg3 for all occurrences of # of arg2 in arg1 arity('S') = arity of S if S is a set; else 0 # for use with _SETS, as in # display{s in _SETS} arith(s); There is no implicit conversion of strings to numbers, but new builtin functions num(string) and num0(string) perform explicit conversions. Both ignore leading and trailing white space; num complains if what remains is not a valid number, whereas num0 just converts as much as it can (returning 0 if it sees no digits). The expressions 'abc' & x+3 and 'abc' & sprintf("%.g",x+3) yield the same strings. Now, e.g., setof{i in 1..3} 'ABC' & i = {'ABC1', 'ABC2', 'ABC3'}. The match, sub, and gsub functions accept strings representing regular expressions as their second arguments. Such expressions are as in plan 9. They are similar to the regular expressions recognized by the Unix editors ed and sed, except that parentheses as operators must not be escaped, and, in addition to * for 0 or more occurrences of the preceding item, + means 1 or more occurrences, and ? means 0 or 1 occurrence. The replacement patterns (third arguments) for sub and gsub are like those for ed and sed: & stands for the whole matched string, as does \0, and \1, \2, ... \9 stand for the string matched by the first, second, ..., ninth parenthesized expression in the pattern. New "cd" command reports or changes the current working directory. New automatically updated params _nvars = number of variables in current model _ncons = number of constraints in " " _nobjs = number of objectives in " " _varname{1.._nvars} = names of variables in current model _conname{1.._ncons} = " " " " " " _objname{1.._nobjs} = " " " " " " and synonyms for current model entities: _var{1.._nvars} = synonyms for variables in current model _con{1.._ncons} = " " constraints " " " _obj{1.._nobjs} = " " objectives " " " These synonyms can be used in display and other commands. They present the modeler's view (before presolve). Similarly automatically updated entities with _ changed to _s (i.e., _snvars, _svarnames, _svar, etc.) give the solver's view, i.e., the view after presolve. New automatically updated sets: _PARS = set of all declared param names _SETS = " " " " set " _VARS = " " " " variable " _CONS = " " " " constraint names _OBJS = " " " " objective " _PROBS = " " " " problem " _ENVS = " " " " environment " _FUNCS = " " " " (user-defined) functions These sets may appear in commands, such as display and print. New additions to the reserved-word list: Current, Initial, all, environ, option. The other new names appearing above may be declared to be something else. 19950412: Enforce the restriction that $values and synonyms (such as _VARS and _nvars) may not appear in declarations. Abort reading commands from files other than stdin after detecting an error. WATCOM binaries are now compiled to circumvent the Pentium divide bug. Preliminary implementations of xref, delete, purge, and redeclare: New command xref shows entities that depend directly or indirectly on specified entities. Syntax: xref itemlist optional_redirection; New command delete foo; deletes foo, restoring any previous meaning foo had, provided no other entities depend on foo, i.e., if "xref foo;" reports no dependents. New command purge foo; deletes foo and all its (direct or indirect) dependents. New form of declaration: "redeclare" followed by an ordinary redeclaration replaces any existing declaration of the specified entity with the given one, provided either that the entity has no dependents, or that the new declaration does not change the character of the entity (its kind, such as set or param, and its number of subscripts). Redeclarations that would cause circular dependencies are rejected. New symbolic system parameter solve_message is assigned the message shown (when not suppressed by "option solver_msg 0;") by the solve and solution commands. One can assign solve_message with "let", but may not delete or redeclare it. New variants of break: break commands; break all; terminate, respectively, the current commands command or all commands commands, if any, and otherwise act as a "quit" command. 19950416: Extend $solver_auxfiles interpretation: capital letters have no affect on linear problems, but on nonlinear problems (including problems with binary or integer variables) are treated the same as their lower-case equivalents. The default $minos_auxfiles is now RF rather than rf, causing .row and .fix files to be written only for nonlinear problems. 19950501: New function indexarity('foo') gives the arity of foo's index set if foo has been declared to be something indexed, or 0 if foo has been declared as something that is not indexed, or -1 if foo has not been declared. Example: display{i in _PARS} indexarity(i); 19950517: Check statements are now only enforced during solve, write, and solution commands, or when the new command check; is executed. Dot notations that require presolve are now excluded from declarations. 19950521: New variant of close command: close; closes all files opened by redirections. 19950614 Arrange for option funcwarn only to affect constraint and objective declarations. Thus it no longer affects function zot; param p := zot(3); # used to get msg about variable in := display p; # now elicits msg about zot missing Change in writing of auxiliary .fix file: values of variables fixed by presolve are suppressed unless $auxfiles or $($solver & '_auxfiles') contains "v". (The primary reason use of the .fix file is now to convey names of defined variables for use in printing error messages. This change omits sometimes lengthy work that is hardly ever useful.) Warn of missing subscripts on sets. (Later we hope to warn about other missing subscripts, but that's harder.) 19950619 Introduce variant _display of the display command; _display is meant for possible use by front ends. Like the display command, _display emits one or more tables, but _display replaces display's table header with a line consisting of "_display" and three integers: s = number of subscripts of each item in each table line k = number of items on each table line n = number of table lines Each table line consists of s subscripts followed by k items, all separated by commas. No semicolon is appended to the table. 19950720 Add another variant of the display command: csvdisplay is similar to _display, except that it only writes one table (complaining if asked to write more than one), and it replaces the initial _display output that describes the following table with $1,$2,...,$n (where n is the number of items in one line of the table that follows). New options csvdisplay_precision and csvdisplay_round govern the precision of printing for csvdisplay; the defaults (0 and '') give full precision. 19950726 Adjust _display's printing so numeric precision is governed by $csvdisplay_precision and $csvdisplay_round. In -M output and printing by the show command, insert "s.t. " before constraints. New option csvdisplay_header (default 1): if nonzero, cvsdisplay's first line now has the form Index_1,Index_2,...,Index_k,Expr_1,...,Expr_n (where k is the number of subscripts and n the number of expressions in one line of the table that follows); if the jth expression is a simple name (not of the form Index_i or Expr_i) that has not appeared previously in the current csvdisplay header line, then that name appears rather than "Expr_j". If $csvdisplay_header is 0, this header line is omitted. Adjust line breaking for "show" and omit some extraneous commas. Diagnose some more undefined names (e.g., in problem declarations). Recognize repetition counts in next nnn skip nnn step nnn 19950810 Allow the print command to have no arguments, which causes it to behave the same as printf "\n"; 19950827 New debugging option: $debug_stub, if not '' (its default value), is used to construct stubs of the form ($debug_stub & '_1'), ($debug_stub & '_2'), ... in solve commands. If a file named ($debug_stub & '_1.sol'), ($debug_stub & '_2.sol'), etc. exists, "solve" behaves as "solution" and reads the .sol file. Otherwise it leaves behind its .nl and .sol files, so a subsequent ampl run can read the .sol files (and the .nl files are available for debugging purposes). This permits recreating some situations without rerunning the solvers involved. The .nl files (and hence .sol) files are ASCII files to make it easy to create them on one kind of machine and use them on another. 19951009 New command: reset function; closes all pipe functions and unlinks all dynamically linked functions, causing them to be restarted or relinked if invoked again. For a specific function foo, reset data foo; acts just on function foo. New command: delete check n; deletes the n-th check. Extension of redeclare syntax: redeclare check n optional_indexing : ...; redeclares the n-th check. New addition to reserved-word list: dotname (for use in a forthcoming extension). 19951020 Allow "reset data p;" even when p is declared with a := expression, to force recomputation of random functions in the := expression (and to force reevaluation of any user-defined functions in the expression). Extend "reset data;" to force recomputation of all := expressions. 19951027 Now problems (including the current one) should be adjusted when their indexing expressions change, except that previous explicit drop, restore, fix, and unfix commands remain in effect. The new "reset problem" command cancels this treatment of previous explicit drop, restore, fix, and unfix commands, and brings the problem to its declared drop/fix state. This command has the forms reset problem; # applies to the current problem reset problem foo; reset problem goo[subscripting]; If the latter forms mention the current problem, they have the same effect as the first form. For now, at least, "reset problem" does not affect the problem's environment. 19951202 Arrange for option relax_integrality 2; to assume integrality during presolve, but tell the solver that there are no integer variables. Force presolve to run again after $relax_integrality has changed. Increase default value of $pl_bigM from 1e4 to 1e6. Arrange for changes to $pl_bigM to cause presolve to run again when its results would be affected by the change to $pl_bigM. 19951204 Arrange to run presolve (when nothing else has caused it to run) so defined variables involved in dropped objectives or constraints appear to have the "right" values. Example: var x := 2; var y = x^2 + 1; minimize zot: y + 10; drop zot; print zot; # used to print 11 rather than 15 Disallow declarations involving defined_variable.val. (Instead, declare a new param, use the param in the declaration, and use "let" to give it the right value. This helps clarify when things are to be evaluated.) 19960202 Adjust DOS .exe files to print nonzero return codes from solve and shell commands. 19960306 Allow printf's "+" flag to reveal the sign of 0. 19960313 Arrange for redeclarations of variables, constraints, and objectives to retain current values and drop/fix status. 19960330 New call command for directly invoking user-defined functions for their side effects: rather than, e.g., saying "print foo(1,2,3);" or "let Dummy := foo(1,2,3);" to force foo(1,2,3) to be called, you can now say "call foo(1,2,3);". Syntax: call [indexing] function [(arglist)]; 19960418 Terminate includes within the file in a read command's "<" redirection when the read command ends. 19960425 Adjust xref command so it does not show nodes cited in arc declarations. Make it possible to delete and purge arcs. 19960606 Adjust option debug_stub to honor (and retain) ($solver)_auxfiles. Pretend a semicolon appears at the end of command files that end with a compound command with optional final parts missing: repeat ... { ... } # no final condition or semicolon if ... then { ... } # no else clause 19960627 New option (for debugging nonlinear models): option nl_permute (default 3) tells whether to permute constraints and variables as described in "Hooking Your Solver to AMPL". The value, mod 4, tells what to permute: 0 nothing 1 just constraints 2 just variables 3 both constraints and variables Note that some solvers, such as cplex, minos, and osl, require the permutations. 19960709 Prevent execution of problem commands from running presolve (and thus possibly giving an erroneous message about inconsistent constraints). 19960729 Disallow writing MPS files for problems with nonlinear variables. Omit INITIAL bounds from .mps files; they were only needed long ago by minos. New builtin functions: time() returns the current time (in seconds since 00:00:00 1 Jan. 1970 GMT); ctime() returns a 24-character string representing the current time, and ctime(t) returns a similar time representing time t (or the current time, if t is not numeric). 19960816 New predefined param _pid gives the process ID of the AMPL process (a number unique among processes running on the system). New option format_range_errmsg, if not '', replaces %i, %d, %o, %u, %x, or %X in printf commands or sprintf invocations in which the number to be converted is outside the appropriate range of integers. If $format_range_errmsg has its default value of '', an error message appears and the command is aborted. New automatically determined set: _AVAILFUNCS = user-defined functions that have been linked (statically or dynamically) with AMPL and thus can be declared and evaluated in the AMPL session. (Other user-defined functions may be declared and used in constraints and objectives, but AMPL will not be able to evaluate them. It can, however, pass them by name to solvers that know how to evaluate them.) New automatically updated params give some problem statistics the solver sees: _snbvars = number of binary variables used linearly _snivars = number of general integer variables used linearly _snnlcons = number of nonlinear constraints _snnlobjs = number of nonlinear objectives _snzcons = number of nonzeros in the constraint Jacobian matrix _snzobjs = number of nonzeros in objective gradients 19960829 Add "inout" and "out" to the reserved-word list (for use in upcoming extensions). 19961017 New option show_write_files controls whether the write command reports the names of the files it writes: 0 ==> no (default) 1 ==> yes for "write;", no for "write gstub;" 2 ==> yes 19961210 Adjust most commands (but not declarations) to permit unqualified objective, constraint, and variable names in () expressions. Hitherto one had to use objective.val, constraint.dual, and variable.val. Now one can write something like option cplex_options (sprintf('... uppercutoff=%.f ',_obj[1])); (rather than _obj[1].val) to adjust an option to reflect an objective value from the most recent solve. Disallow expressions involving variables in arguments to member, ord, ord0, next, nextw, prev, and prevw, when they appear in constraint and objective declarations. 19970307 Arrange for variable values of 0 assigned by "let" to be explicitly conveyed to solvers unless $reset_initial_guesses is nonzero. Previously they were explicitly conveyed only after a solve, or if they were given in a data section or variable declaration. 19970314 Arrange for "option gentimes 2" to show total memory rather than incremental memory. Tweak -T output so "genmod times" lines (other than headers) always start with "## ". This was hitherto only true for seq numbers <= 99. 19970528 Extension to expand command: recognize synonyms (possibly subscripted _con, _obj, _var, _scon, _sobj, _svar). 19970615 Adjust the tests involving $pl_bigM (done when linearizing nonconvex piecewise-linear terms) to assume a lower bound of (smallest breakpoint) - $pl_bigM and upper bound of (biggest breakpoint) + $pl_bigM on the variable "multiplied" by a piecewise-linear coefficient when the true bounds on the variable exceed these values (instead of just when the true bounds are infinite). 19970729 Fix bug with random functions that caused some expressions involving them not to be reevaluated. Example: set S default {}; repeat { let S := S union {Uniform(0,15)}; } while(card(S)) < 5; looped infinitely. Change exit to a command of the form exit ; or exit expression ; The expression, if given, must be numeric and specifies the process return code; an omitted expression is treated as 0. Change "quit;" to be equivalent to "exit ;", which means it may now appear in compound commands. Here, stands for the return code that "quit" has always given, which reflects recent syntax errors (and is cleared to 0 by successful command executions). Fix some bugs with "break commands;" and "break all;"; adjust these commands so if no "commands" command is being executed, they terminate the current nest of includes, if any, and otherwise are no-ops. 19970731 Fix bug in presolve for problems with integer (or binary) variables: for $presolve > 1, if a constraint with two remaining nonzeros caused an integer variable to be fixed and the constraint had previously implied a bound on the other variable, that bound was not conveyed to the solver. (Note that $presolve is 10 by default; specifying "option presolve 1;" avoids the bug.) Add a Caution for writing an MPS file for problems with integer variables having infinite bounds. There's no "standard" MPS way to express such problems. 19970814 With invocations with -o (and no commands that would cause the -o command-line option to be ignored), if presolve fixes all variables, say so and give process return code 16 rather than 0. New command-line option -R (recognized only as the first command-line option and not mentioned in the "-?" listing of options) puts AMPL into "server mode", in which it declines to execute cd and shell commands, forbids changes to options TMPDIR, ampl_include, and PATH (or whatever is the usual name of the search path for the operating system being used), disallows pipe functions, and restricts names in option solver and file redirections to be alphanumeric (so they can only write to the current directory, which, on Unix systems at least, cannot be changed). By invoking ampl from a shell script that suitably adjusts the current directory and environment variables TMPDIR, ampl_include, and PATH before it invokes "ampl -R", one can control the environment in which "ampl -R" operates. 19980127 New syntax for expressing complementarity constraints: in addition to previous forms, constraint declarations may now have the form constraint_start : constr1 complements constr2 ; in which constr1 and constr2 consist of 1, 2, or 3 expressions separated by the operators <=, >=, or == (or =). As with other constraint declarations, constraint_start gives a name to the constraint, an optional descriptive string (alias), and, if the declaration describes a collection of constraints, an indexing expression. In constr1 and constr2 together, there must be a total of two explicit inequality operators, with == counting as two. A complementarity constraint is satisfied if both constr1 and constr2 hold and at least one inequality is tight, i.e., satisfied as an equality. If one of constr1 or constr2 involves two inequalities, then the constraint must have one of the forms expr1 <= expr2 <= expr3 complements expr4 expr3 >= expr2 >= expr1 complements expr4 expr4 complements expr1 <= expr2 <= expr3 expr4 complements expr3 >= expr2 >= expr1 In all of these cases, the constraint requires the inequalities to hold, with expr4 >= 0 if expr1 == expr2 expr4 <= 0 if expr2 == expr3 expr4 == 0 if expr1 < expr2 < expr3 For expressing MPECs (math. programs with equilibrium constraints), complementarity constraints may coexist with other constraints and objectives. The suffix notations, such as constraint.lb, constraint.body, etc., are extended so that for a complementarity constraint, constraint.Lsuffix and constraint.Rsuffix correspond to constr1.suffix and constr2.suffix, respectively, and complementarity_constraint.slack (or the unadorned name) stands for a measure of the extent to which the complementarity constraint is satisfied: if constr1 and constr2 each involves one inequality, then the new measure is min(constr1.slack, constr2.slack) (which is positive if both are strictly satisfied, 0 if the complementarity constraint is satisfied exactly, and negative if at least one of constr1 or constr2 is violated). For constraints of the form expr1 <= expr2 <= expr3 complements expr4, the .slack value is min(expr1-expr2, expr4) if expr1 >= expr2 min(expr2-expr3, -expr4) if expr3 <= expr2 -abs(expr4) if expr1 < expr2 < expr3 so in all cases, the .slack value is 0 if the complementarity constraint holds exactly and is negative if one of the requisite inequalities is violated. Solvers see complementarity constraints in the standard form expr complements lb <= variable <= ub A new synonym, _scvar{i in 1.._sncons}, indicates which variable, if any, complements constraint _scon[i]: if _scvar[i] in 1.._snvars, then variable _svar[_scvar[i]] complements constraint _scon[i]; otherwise _scvar[i] == 0, and _con[i] is an ordinary constraint. Other new synonyms: _cconname{1.._nccons} are the names of the complementarity constraints as the modeler sees them. A forthcoming paper ("Expressing Complementarity Problems in an Algebraic Modeling Language and Communicating Them to Solvers", by Michael C. Ferris, Robert Fourer, and David M. Gay) discusses the new complementarity syntax. The paper will be available from the AMPL web site (http://www.ampl.com/ampl/) after it has gone through the Bell Labs release process. Anticipating extensions to be described later, the following words IN INOUT LOCAL OUT suffix are now reserved. This breaks the blend.mod and blend.dat distributed with the AMPL book, in which it's necessary to change OUT to Out and IN to In. 19980128 Introduce some new automatically updated params that give information about the current problem, either as seen by the modeler (_nccons), or by the solver (names that start with "_s"): Name Meaning _nccons No. of complementarity constraints before presolve _snbvars No. of binary (0,1) variables _snccons No. of complementarity constraints after presolve _snivars No. of general integer variables (excluding binaries) _snlcc No. of linear complementarity constraints _snlnc No. of linear network constraints _snnlcc No. of nonlinear compl. constrs.: _snccons = _snlcc + _snnlcc _snnlcons No. of nonlinear constraints _snnlnc No. of nonlinear network constraints _snnlobjs No. of nonlinear objectives _snnlv No. of nonlinear variables _snzcons No. of constraint Jacobian matrix nonzeros _snzobjs No. of objective gradient nonzeros 19980208 New builtin suffixes: variable.defeqn is the subscript of _con for the corresponding defining constraint if the variable is a defined variable, and is 0 otherwise. Similarly, constraint.defvar is the subscript of _var for the resulting defined variable if the constraint defines a defined variable (either through the var = syntax or because of option substout), and is 0 otherwise. New options log_model and log_data (default 0): if option log_file is not '', declarations and commands in included files are copied to $log_file if $log_model is 1, and included data sections are copied to $log_file if $log_data is 1. Edit change description of 19950619 above to describe _display. For convenience, here is a summary of _display and csvdisplay. Commands _display and csvdisplay are variants of display that emit tables in a more regular format than does display: each line of a table starts with s subscripts and ends with k items, all separated by commas. _display and csvdisplay differ in the table headers they emit. The header for _display consists of a line starting with "_display" and followed by three integers s, k, and n (the number of table lines that follow the header), each preceded by a space. Whether csvdisplay emits a header is determined by option csvdisplay_header (default 1): if $csvdisplay_header is 1, cvsdisplay's first line has the form Index_1,Index_2,...,Index_k,Expr_1,...,Expr_n (where k is the number of subscripts and n the number of expressions in one line of the table that follows); if the jth expression is a simple name (not of the form Index_i or Expr_i) that has not appeared previously in the current csvdisplay header line, then that name appears rather than "Expr_j". If $csvdisplay_header is 0, this header line is omitted. Options csvdisplay_precision and csvdisplay_round govern the precision of printing for _display and csvdisplay; the defaults (0 and '') give full precision. 19980302 Introduce (on all systems other than AIX and MSDOS, but including W95 and NT) a new scheme for acquiring imported functions: execute ampl -i? for more details. More extensive documentation will appear later. 19980309 Change to option pl_linearize: the default value (1) now uses a more efficient linearization of nonconvex (resp. nonconcave) piecewise-linear terms and uses suffixes .sos and .sosref to tell solvers that handle SOS sets about the variables and constraints that imply the SOS2 constraints introduced by the linearization. A forthcoming update to the AMPL/solver interface library will provide sample interfaces that exploit this new information. To get the old behavior, specify option pl_linearize 2; Versions 19980305 and 19980308 had glitches in this change. 19980325 New options shell_exitcode_max (default 2^16) solve_exitcode_max (default 0) cause compound commands to be aborted if a shell command results in $shell_exitcode > $shell_exitcode_max or a solve command results in $solve_exitcode > $solve_exitcode_max . The defaults give the old behavior (except for the unlikely case of shell_exitcode > 2^16). 19980408 Remove prohibition on "reset data" and "update data" commands appearing in compound commands. 19980525 When "solve;" fails, set solve_result = '?', solve_result_num = -1, and solve_message = '?'. 19980605 Recognize _obj.astatus, _sobj.statsus, _obj.astatus_num, and _sobj.astatus_num. The latter two are always 0 (in the problem), the former two "in" unless $astatus_table has been changed from its default value. 19980615 Permit potential defining constraints (other than those introduced by "var ... = ..." declarations) to participate in the strong bound deductions attempted when $presolve > 1, unless $substout mod 4 == 2. Previously, if there were any "var ... = ... " declarations or $substout was nonzero, potential defining constraints were excluded from the strong bound deductions. Specifying "option substout 2" gives the old behavior of "option substout 0", and "option substout 3" gives the old behavior of "option substout 1". The new $substout values 2 and 3 are for possible debugging and their effect may be withdrawn later; values 0 and 1 are the only ones that should normally be of interest. Adjust logic for checking conditions on sets and parameters: when "update data" and "let" provide new subscripts or modify existing values, just check the new or changed items. This changes the time for some loops from quadratic in the number of iterations to linear. If reports of failed conditions are interrupted by $eexit, the list of questionable subscripts is currently not purged. Otherwise each new value causes only one warning if it fails a condition. 19980625 New builtin param _cmdno is 0 initially (or after reset) and is incremented each time a command is executed. New option project_fixed_vars (default 1): if nonzero, presolve projects fixed variables onto their bounds (even if $presolve is 0). If $project_fixed_vars == 2, a message is printed for each fixed variable that is projected (until $presolve_warnings such messages have appeared). It is possible for a variable to appear only in constraints that imply bounds on the variable. When $presolve > 0, such constraints are eliminated. Presolve now projects such variables onto the interval given by their tightest deduced bounds. Here is an example illustrating this and the new option project_fixed_vars: var x >= 3 <= 3 := 4; var y >= 0 := 7; s.t. foo: x + y <= 3.5; display y; fix x; solexpand; display y; Previously, this example gave the output y = 7 presolve, variable y: impossible deduced bounds: lower = 0, upper = -0.5 Infeasible constraints determined by presolve. s.t. foo: <= -0.5; y = 7 The message about infeasibility appeared because "fix x" fixed x at 4, which made constraint foo impossible to satisfy. Now the example gives y = 7 Solution determined by presolve. y = 0.5 Notice that y has been projected onto the interval [0,.5] implied by constraint foo with x == 3. 19980714 Upon encountering end-of-file after at least one variable declaration but no objective or constraint declarations, print "No variables used" rather than "No variables declared". 19980717 Do not terminate compound commands when a command, such as solve, incurs infeasibility (or other) warnings from presolve. Have the solve command set solve_result_num to 299 (rather than 200) when presolve determines that the problem is inconsistent. 19980716 Minor cosmetic tweak: when echoing new suffix declarations issued by a solve or solution command, only put an extra newline in front of the first echoed suffix declaration. 19980722 For symbolic suffixes, binary or integer applies to the _num value. New builtin suffixes .no and .sno: if foo[i] is _xxx[j], then foo[i].no = j (for xxx in {"con", "var", "obj"}); similarly, if foo[i] is _sxxx[j] then foo[i].sno = j, and foo[i].sno = 0 if the solver does not see foo[i]. Permit "display _obj.user_defined_suffix;" and "display _sobj.user_defined_suffix;". 19980730 Record settings of $linelim and $substout in .nl files, and adjust these options, if necessary, when reading solutions. 19980905 Adjust "display x;", where x is an indexed variable, so it does not run presolve. 19980912 Correction to 'Adjust "display x;"' in 19980904 above; if x was a defined variable, sometimes it was not recomputed. 19981009 Permit ":= {}" in set declarations. Permit set expressions of the forms if test then {} else set_expr and if test then set_expr else {} with the set_expr supplying the dimen (arity) of the empty set {}. 19981014 Permit "display p.result;" for indexed collections of problems p. For infeasibility detected by presolve, have the solution, solve, and write commands update the 'result' suffix of the current problem. 19981109 New builtin params recording execution times (where possible): _solve_time = _solve_user_time + _solve_system_time record CPU seconds for the most recent solve command, and _solve_elapsed_time records wall-clock seconds for the most recent solve; prepending _total gives sums of the corresponding entities for all solve commands; changing "solve" to "shell" gives analogous values for shell commands. And _ampl_time = _ampl_user_time + _ampl_system_time and _ampl_elapsed_time give analogous times for AMPL itself, excluding times for shell and solve commands. On all systems, the elapsed time params are computed by the time() function, which has a granularity of whole seconds. The new CPU time params report true CPU seconds on Unix and Windows NT systems (with Win32 binaries, such as ftp://netlib.bell-labs.com/netlib/ampl/student/mswin/samplnt.exe.gz). On Windows 9x or 3.x, and on MS-DOS systems, CPU times are not available; the system times are set to 0, and user times are elapsed (wall-clock) seconds since the start of execution -- with a finer granularity than the time() function. 19981214 Adjust error message for a symbolic data-section value for a numeric parameter. For example, the old message type['HOST'] cannot be #ENDPOINT is now type['HOST'] must be numeric, not 'ENDPOINT' Adjust "objective;" command so it does not try to instantiate the current problem unless there is a partially dropped array of objectives (in which case ampl must worry about which subscripts are valid). "Invisible" change: put suffix information ahead of nonlinear information in .nl file, so .nl reading can be influenced by suffixes. 19990112 Ignore gratuitous reset commands. Modified linearization of piecewise-linear terms. To get the linearization that had been the default since 19980309, specify option pl_linearize 3; 19990120 New addition to reserved-word list: table. 19990304 ftp://netlib.bell-labs.com/netlib/ampl/student/mswin/samplnt.exz: Under W9x, treat '/' as '\' in the names of programs invoked by the shell and solve commands. (This already worked under NT, but Microsoft does not tolerate much consistency among its operating systems.) 19990421 Try to avoid leaving temporary files behind in the face of various signals, such as SIGINT and SIGHUP. Have printf "%q",''; print '' rather than nothing. New builtin symbolic param _cd is set to the current directory initially and each time the cd command is executed. New variant -bs (and -brs) of command-line option -b for GUIs that want to run solvers themselves. Ask dmg for details. Have "option solver_msg 0;" suppress messages that appear when presolve determines the solution (as well as the solution_message returned by a solver). 19990607 Table and out-arg extensions, to be described later. 19990804 When an input file ends with a #comment not terminated by a newline, assume a newline after the comment. Permit the close command to mention a comma-separated list of files to close. Change to filename syntax: disallow commas in unquoted filenames. This permits one to say things like load lib1, lib2; and close file1.stuff, file2.xyz; without treating the "," as part of the file name. Change to $ampl_include: previously it was a white-space separated list of directories in which to look for files mentioned by "include", "model", and "data"; now spaces are allowed within directory names (but not before or after them), and directory names in $ampl_include should be separated by newlines (or tabs, but tabs invite confusion; for example, X-Windows turns tabs into spaces). Change $AMPLFUNC to behave similarly to $ampl_include: directory and file names may contain internal blanks, and $AMPLFUNC now specifies a sequence of zero or more file or directory names from which to import functions. Each name is first treated as the name of a shared library (or DLL -- suffixes, such as .dll, must be explicit); if a library by that name cannot be opened, the name is treated as a directory name, and "/amplfunc.dll" (or "\amplfunc.dll" under MS Windows) is appended to obtain the name of a library to load. The solve command now adjusts $ampl_funclibs to be a newline- separated list of full pathnames of libraries from which functions in the current problem instance were imported. New commands load [libname [, libname ...] ]; unload [libname [, libname ...] ]; reload [libname [, libname ...] ]; load, unload, or reload shared libraries (from which functions and table handlers are imported). When at least one libname is mentioned in the load and unload commands, $AMPLFUNC is modified to reflect the full pathnames of the currently loaded libraries. The reload command first unloads its arguments, then loads them. This can change the order of loaded libraries and affect the visibility of imported functions: the first name wins. With no libname arguments, "load;" loads all the libraries currently in $AMPLFUNC; "unload;" unloads all currently loaded libraries, and "reload;" reloads them (which might be useful if some have been recompiled). New and adjusted system sets: _LIB = currently loaded libraries; _AVAILFUNCS = currently available imported functions (which still must be declared before use) _AVAILFUNC2 = (available function, library) pairs (permits seeing which library is currently supplying an available imported function) _SFUNCS = imported functions that "solve;" currently uses. New command remove [filename [, filename ...]]; closes and removes the files mentioned. "remove;" does nothing. Exception: "remove ($log_file);" just truncates (removes and then reopens) $log_file, much as "close ($log_file);" does. Extensions of funcadd.h for (still to be described) table handlers; the updated funcadd.h is now in /netlib/ampl/solvers. 19990818 MSDOS and Win32 "ampl" binaries: add expansion of * and ? in command- line arguments, and replace command-line arguments of the form @filename with the contents of file filename. Win32 "ampl" binaries: recognize quoted white space in command-line arguments, no matter who provides the command line (e.g., another program calling CreateProcess). White space may be quoted with either single or doubled quotes (' or "). Within a quoted string, the quote character may appear if it is doubled (as in AMPL strings). 19991130 Win32 binaries only: adjust the cd command so sequences like cd c:/some/place/other/than/the/starting/directory; cd d:; print 'something' >'c:zot'; shell; will show the adjusted current directories to spawned processes (in "solve" and "shell" commands) and will interpret 'c:zot' correctly (as c:/some/place/other/than/the/starting/directory/zot). Note that under DOS, W9x, and NT, you can use / in place of \ in file names. [For reasons known only to Microsoft, under W9x, a spawned command.com gets its current directory information in some other way than do Win32 programs, so "shell" commands under W9x only reflect cd commands for the current drive. This problem goes away if you set option COMSPEC to a Win32 command processor.] 20000128 New command-line option -vi[nnn] to specify whether stdin should be treated as interactive. The default is to choose based on isatty(): if stdin and stderr both appear to be a terminal, i.e., isatty(0) and isatty(2) both return 1, assume stdin is interactive. Invoke ampl -v? for a summary of all -v options; the description of -vi is -vi[nnn] {interactive mode? (Must be first.) nnn = 0 ==> no, nnn = 1 ==> yes but no prompts, nnn = 2 ==> yes with prompts, nnn = 3 ==> 0 or 2, based on isatty()} In non-interactive mode, syntax errors now inhibit execution of commands and terminate reading of the current file; previously, commands were sometimes executed. (Block input mode, used by AMPL Plus and sample GUIs in http://www.ampl.com/ampl/GUI/expermt.html, remains interactive.) New default presolve behavior: simplifications that appear to convert nonlinear expressions to linear expressions really do so. Change to option linelim: "option linelim 0" and "option linelim 1" work as before, while "option linelim 2" and "option linelim 3" suppress the new conversion of "nonlinear" linear expressions resulting from presolve simplification to true linear expressions, and otherwise behave like "option linelim 0" and "option linelim 1", respectively. 20000216 Increase the resolution of _solve_elapsed_time, _shell_elapsed_time, and "option randseed 0;". The latter now changes more quickly. Warn about "fix x := 3;" when x is a subscripted variable. New builtin LOCAL suffix .relax: for integer or binary variables, .relax > 0 indicates that the integrality of the variable should be ignored. Turn <<0;0,0>>x into 0. 20000217 Arrange for integer_variable.relax values >= 2 to cause solvers to see the variable as continuous, but for presolve to treat it as an integer variable. Also, have nonzero $relax_integrality to take precedence over .relax suffix values, so option relax_integrality 1; # ignore integrality everywhere and option relax_integrality 2; # use integrality in presolve, # but tell solvers all variables # are continuous operate as heretofore, regardless of .relax settings. For "let" assignments to variable.declared_suffix, do not require the "collect" phase. 20000228 Under MS Windows, allow for spaces in $TMPDIR. In situations where bounds on a defined variable are equivalent to bounds on a problem variable that the solver sees, reflect bounds on the defined variable to the problem variable and remove the constraint that implied the bounds on the defined variable. Example: var x; var y = 3*x + 2; s.t. ybound: 5 <= y <= 11; # reflect into bounds on x minimize zot: y^2; Deduce bounds on defined variables in more cases. Temporary(?) treatment of $substout: the "4" bit of $substout, i.e., arranging that ($substout mod 8) >= 4, suppresses today's reflection of bounds and stronger deductions of defined-variable bounds. 20000307 Arrange for "option presolve_warnings -1;" to suppress both the presolve message about how many presolve messages were suppressed and the message about which modified options might help. 20000316 Increase the resolution of _ampl_elapsed_time, and have "reset;" reset _ampl_elapsed_time, even when there were no declarations to discard. (Otherwise, "reset;" is a no-op in this case.) 20000327 Tweak to hash-table logic to speed up reading data on some large examples (with many symbols). Tweak to "option linelim 1" output: nonlinear defined variables that have no linear terms but are used linearly in a constraint or objective are no longer split into two parts (unless, temporarily, the "4" bit of $linelim is on, i.e., $linelim mod 8 >= 4). Command-line option -L now accepts an optional integer immediately following the "L" (no space) to specify the initial $linelim setting. No integer ==> -L1 (the old behavior). Change the default option linelim from 0 to 1. 20000427 Tweak permitting use of AuxInfo (new field ae->AI) in imported functions. This is available when ae->ASLdate >= 20000427. In calls from AMPL, ae->AI is always null, but solvers can arrange for it to have useful values. 20000505 Arrange for "option compl_warn 0" to suppress the warning message about nonsquare complementarity systems and for "option compl_warn 2" to cause nonsquare complementarity systems to be infeasible. 20000602 Treat variables in defining declarations (var x = ...) as defined variables even when bounds are reflected on them. 20000608 Addition to funcadd.h: char* getenv(const char*), which lets imported functions and table handlers access the current environment (as modified by option, environ, and problem commands). Only use getenv (i.e., (*ae->Getenv)) if al->ASLdate >= 20000608. 20000615 Fussy numeric detail: ignore case in recognizing Infinity and NaN in data sections and in format %q, so printf "%q\n", 'nan'; now prints 'nan' rather than nan This fixes a glitch with AMPL's writing of .tab values involving symbolic parameters with values like 'infinity' and 'nan', which should be kept as strings, not turned into numbers, much as '123' and 123 are distinguished. 20000706 When loading a library, arrange for subsequent unloading of the library to happen after any at_exit() or at_reset() processing requested directly or indirectly by addfunc(). (This matters to an experimental facility for importing Java functions.) In calls on imported functions, ensure that al->dig == 0 when al->deriv == 0. 20000814 Recognize command-line option -b?. 20000825 Adjust prompts to indicate "Waiting for end of line after #" and "Saw /*; waiting for */". To indicate the former, # is inserted at the start of the prompt; for the latter, * is similarly inserted. If the prompt string would otherwise be the empty string, nothing is inserted. Change to builtin "sub" and "gsub" functions: treat \n as newline (as in the "sam" editor of plan 9). Thus the pattern (.|\n)* now matches everything until the end of the string, including intervening newlines. Make variable.no independent of whether the variable is fixed. Adjust presolve to make more ambitious the extended presolve iterations that occur when $presolve > 1: when a variable is fixed, consider implications of modified constraints involving two or more remaining (unfixed) variables in the current extended presolve iteration rather than the next one; and when fixing two or more variables leads to simplifications of the same constraint, the first with implications for one bound (lower or upper), the second for the other, consider implications for both bounds. (Temporarily, option presolve_debug 3 suppresses these changes.) Have presolve use values of $presolve_eps, $presolve_fixeps, and $presolve_inteps that are rounded up by function R(x) = if x > 0 then 1.1^ceil(log(x)/log(1.1)) else 0. Encode the relevant values in .nl file headers and arrange for the solution command to issue option commands if necessary to set $presolve_eps, $presolve_fixeps, and $presolve_inteps to values that permit correctly reading the solution. In addition to using option presolve_fixeps during simple presolve reductions (those for $presolve = 1) to decide when tighter bounds lb and ub on a variable v (lb <= v <= ub) are close enough to consider v fixed (when ub - lb <= R($presolve_fixeps)), also use this test when extended presolve iterations ($presolve > 1) reduce ub - lb; in this case, v is fixed to if ub < 0 then ub else if lb > 0 then lb else 0. (Temporarily, "option presolve_debug 8" suppresses this.) New system params _presolve_eps_L and _presolve_eps_U indicate whether changes to $presolve_eps would matter: they should not matter if _presolve_eps_L <= R($presolve_eps) < _presolve_eps_U. Similarly, new system parameters _presolve_fixeps_L _presolve_fixeps_U _presolve_inteps_L _presolve_inteps_U give corresponding bounds for $presolve_fixeps and $presolve_inteps: presolve results should not change as long as _presolve_fixeps_L <= $presolve_fixeps < _presolve_fixeps_U and _presolve_inteps_L <= $presolve_inteps < _presolve_inteps_U. Rerun presolve if $constraint_drop_tol changes. This already happened for $presolve_eps, $presolve_fixeps and $presolve_inteps. Arrange for option show_stats 2 to produce the same output as option show_stats 1, plus an additional line about $presolve settings: report current $presolve and indicate whether a smaller value would suffice (albeit saving no time) or a larger value might give stronger bounds. In the latter case, the possible improvements are sometimes minuscule. Two new builtin params give values that help determine the new line: _presolve_req is the value of $presolve needed to reproduced the results of the last run of presolve. (This value has long been encoded in .nl files to facilitate correctly reading .sol files.) _presolve_sug = presolve_req if further presolve iterations would not help and is otherwise either $presolve + 1 (if $presolve > 0) or 10 (if $presolve = 0). Values of $presolve_*eps shown in output for $show_stats = 1 or 2 are now rounded to assure changes to R($presolve_*eps). 20000906 Arrange for redeclarations of unsubscripted sets with no := clause to retain their values (when redeclared to be a set of the same arity). Example: set S ordered; data; set S := a b c; display S; redeclare set S ordered; display S; # OK now; previously "no data for set S" 20001002 Add "contains" to the reserved-word list. (Later, it will be a set-comparison operator, with A contains B <==> B within A.) 20001006 Turn v1*sum{i in A} p[i]*v[i] into zero, where v1 and v[i] are variables and p[i] == 0 for all i. 20001128 ampltabl.dll: handle .dsn files better (no longer require them to contain DBQ= lines); no longer require DSN=... strings to contain DBQ=...; permit DRIVER=... to specify a full connection string (as well as DSN=...); handle driver-specific types in addition to the ODBC standard ones. 20010129 In iterated commands and expressions, permit {if logical_expression} wherever indexing expressions were previously allowed. 20010130 For completeness, permit {if logical_expression} as the indexing in iterated reduction operators (sum, prod, min, max, exists, forall). 20010322 Again adjust "option randseed '';" and AMPL's -s command-line option to make it more likely that successive invocations will give different values. The changes are visible mainly on Microsoft systems. 20010405 New Caution: unless $Caution is 0, warn about numeric option settings where part of the option string is ignored. In response to "solve;" after a previous command has caused presolve to determined the solution or eliminate all variables, if $solver_msg is nonzero (as it is by default), print solve_message again -- it should also have appeared after the previous command, and it explains the situation. Example: var x >= 1 <= 2 := 3; var y = x + 2; solve; # "No variables used after elimination of defined variables." solve; # now gives the same message, rather than silence. 20010507 In imported (user-defined) functions, have printf("%s",0) print "" rather than fault. When presolve determines a feasible solution, set solve_result_num = 99. 20010816 Sample ampltabl.dll for MS Windows: when reading tables in an explicitly specified file, use the full pathname in "DBQ=..." to avoid confusion with similar names known to the ODBC Data Source Administrator. When writing tables, the sample ampltabl.dll still tries to use "DSN=..." if possible. Note that to permit writing .xls files, it's necessary for the ODBC Data Source Administrator to have a DSN (e.g., a User DSN) associated with the Microsoft Excel driver with the "Read Only" box unchecked (under Options in ODBC Microsoft Excel Setup). 20011119 Ensure that A union B puts members of A first. Usually it did, but under some conditions the members of B came first. 20011206 Adjust processing of (the default) "option linelim 1" so defined variables that are not involved in the current problem will not be affected by "option linelim 1" (which took considerable time in a motivating example). The temporary interpretation of the "4" bit of $linelim, introduced 20000327, is rescinded. Now, temporarily (for debugging), when the "4" bit of $linelim is on, today's change to processing for "option linelim 1" will be suppressed. 20011231 New option presolve_assoc (default 7) affects simplification of constants in nonlinear contexts during presolve: sum of 1 ==> permit using associative law on + and - operations; 2 ==> permit using associative law on * and / operations; 4 ==> permit using distributive law on const*(const*thing +- const*thing). Change command-line option -o to write a .nl file at the end of the last command-line input file if a "solve;" command would write a new .nl file. (Note that if no command-line input files are given explicitly, then stdin is treated as the single command-line input file.) 20020409 For properly behaving solvers linked with interface library versions >= 20020402, adjust the reading of .sol files to omit the backspaces that used to appear when the solvers did not report any option settings. 20020503 Add SnprintF and VsnprintF to AmplExports, to make snprintf and vsnprintf available to imported functions. 20020708 Change to handling of multiple objectives: previously objectives were always reordered so that nonlinear objectives came first. Now the default is not to do this reordering. Option nl_permute is extended to allow indicating that objectives should be reordered as heretofore. $nl_permute is now the sum of 1 ==> reorder constraints 2 ==> reorder variables 4 ==> reorder objectives The default value for $nl_permute remains 3. 20020716 Obscure enhancement to handling of complementarity constraints of the form equation complements unbounded_variable: indicate to solvers that the unbounded variable is associated with the equation. Turning the "4" bit of $compl_warn on (usually by "option compl_warn 5;") suppresses this adjustment. 20020801 Tweak to single-step mode: accept a semicolon or white space after the optional repetition count after "next", "skip", and "step". In problems with variables in singleton complementarity constraints, let the complementarity constraints imply the variable bounds when $var_bounds is 1 (the default), unless the variables are also matched with other complementarity conditions. Example: var x; var y; s.t. c1: x >= 0 complements y >= 0; s.t. c2: x + y = 1; display _varname, _var.lb, _var.ub; # above now shows no bounds on y 20020814 In the display command's printing of 2D tables, permit the final ":=" part of the ": ... :=" header to exceed $display_width (to make the output a bit more regular). We can always recant this tweak if it turns out to cause more trouble than it avoids. In set and param declarations, treat = (or ==) as a synonym for :=, so = behaves as it does in var declarations. For param declarations, this is simply an extension. For param declarations, it changes the meaning of =, which previously implied a surprising test that the param had the specified value. (We believe that = was almost never seriously used in this way, so that this change will be harmless. If not, "option old_param eq 1;" restores the old meaning of = in param declarations, at least for now.) Arrange that failed consistency checks detected during a "solve" command will result in solve_result = '?' and solve_result_num = -1, just as they are at the start of execution. Previously they retained their values from the last successful "solve". Change "s.t." to "subject to" in "show" and "expand" commands. 20020924 When foo is a subscripted problem whose declaration does not specify a subscripted environment, have "problem foo;" make foo's environment current. 20021025 Arrange for variables to which piecewise-linear terms are applied to be defined by the linearizations of the terms. On problem 14.7(d) in the AMPL book (first edition; 17.7(d) of the second), this reduces the numbers of variables and constraints by 1/3. Turning the "4" bit of $pl_linearize on, e.g., with option pl_linearize 5; suppresses this change. Infer bounds of 0 and 1 on binary variables, even when they are relaxed by assignment of 1 to their .relax suffix. 20030204 Cut over to a version that works as described in the second edition of the AMPL book, including such relatively obscure features as new tabular forms in data sections, handling of "in union_of_intervals" phrases in variable declarations, and $(expr) string expressions. Some new constraint-logic programming features, described in INFORMS J. Computing 14#4 (2002) pp. 322-344, are also recognized. (Variables in subscripts are still missing.) 20030227 New option strict_ineq_warn (default 1) determines how to handle constraints involving a strict inequality when the constraint would be an algebraic constraint if the comparison were changed to permit equality (i.e., < were changed to <= or > were changed to >=): 0 ==> quietly treat the constraint as a logical constraint; 1 ==> print a caution and treat as a logical constraint; 2 ==> print a warning and reject the constraint. Before 20030204, AMPL behaved as though $strict_ineq_warn were 2. 20030319 Fix glitches with "unload" (which did not completely unload the indicated library) and "delete function_name" (e.g., when the function name coincided with a builtin random function). 20030328 Fix a fault introduced 20030319 in handling ampltabl.dll after a reset. Fix a glitch that sometimes caused "unaligned access" errors on systems with 64-bit addressing. 20030331 Adjust option relax_integrality so binary variables added to linear nonconvex piecewise-linear terms are retained under option relax_integrality 1; and are relaxed, with no suffix information about them transmitted to the .nl file, under option relax_integrality 2; Before this change, solvers might fault unless explicitly told to ignore SOS information when $relax_integrality was 1 and the problem had nonconvex piecewise-linear terms. 20030527 Adjust the output of "expand _con;" and "expand _con[n];" so that when complementarity constraints are present, they are only indicated by a ".L" or ".R" suffix on the constraint name. Previously, if, say, the first constraint was a complementarity constraint, then both "expand _con[1];", "expand _con[2];" and "expand _ccon[1];" all produced the same output, except for the decorations ".L" and ".R" in the constraint names shown for _con[1] and _con[2]. Similarly, "expand _con;" showed complementarity constraints twice, distinguished only by ".L" and ".R" decorations. These decorations now appear after rather than before subscripts. 20030626 Adjust changes made, if necessary, by the "solution" command to $presolve_eps, $presolve_fixeps, and $presolve_inteps to properly read a .sol file corresponding to a .nl file written before changes to those options: multiply the R(x) value shown in the changes of 20000825 by .95 (to put the value roughly halfway between the relevant integer powers of 1.1), then round the result to 3 significant figures. For example, with a suitable solver and problem instance, in write bfoo; solve; option presolve_inteps 37; solution b.sol; the solution command now issues option presolve_inteps 1.04e-06; rather than yesterday's option presolve_inteps 1.0950988861107401e-06; Because of how $presolve_inteps is discretized, "option presolve_inteps 1.04e-6" has the same effect as the default "option presolve_inteps 1e-6". Today's changes also correct a bug in deciding whether to restore $presolve_inteps. On the relatively rare occasions when this bug bit, it might cause reading the .sol file to fail after a surprising "option presolve_inteps..." command was generated and presolve ran again. 20030724 Fix a bug in handling logical constraints (a forthcoming extension): if $auxfiles or $($solver & '_auxfiles') requested a .row file and the problem contained both logical constraints and objectives, a fault was likely. New feature related to this bug fix: when new option convert_logical_to_algebraic has its default value 1, constraints that appear to be logical constraints because they are surrounded by parentheses but that would be recognized as algebraic constraints without the surrounding parentheses are converted to algebraic constraints during parsing. Specifying option convert_logical_to_algebraic 0; suppresses this conversion. 20031017 Diagnose ": =" instead of ":=" in data tables. 20040103 Adjust linearization of a nonconvex piecewise-linear term to use max($pl_bigM, 2*max{b in Breakpoints} abs(b), if lb > -Infinity then abs(lb) else 0, if ub < +Infinity then abs(ub) else 0) where $pl_bigM was previously used (with lb and ub the lower and upper bounds on the variable that the piecewise-linear term multiplies). Turning the "8" bit of $pl_linearize on, e.g., by option pl_linearize 9; suppresses this change, at least for now. 20040821 Print NaN values as NaN, regardless of their sign bits. Previously -Nan was sometimes (incorrectly) printed. The sign bit of a NaN is not supposed to have any meaning. Add new system param NaN (which, on systems with IEEE arithmetic, has the value NaN and in general has the value Infinity - Infinity). 20050530 If a "read" command issued in interactive mode encounters end-of-file, permit further interactive input. 20050702 Note that to get correct dual values for constraints removed by presolve when using an interior-point solver, it's necessary to set $abs_boundtol or $rel_boundtol to a suitable positive value. These options are not described in the AMPL book, but are described in the entry for 19931005 of /netlib/ampl/changes. Note also that not all changes to $abs_boundtol and $rel_boundtol cause recomputations; AMPL records ranges of values for these options that have the same effect and avoids recomputations for changes that do not matter. 20060314 For imported functions, change unsigned long args to size_t, to permit allocating memory blocks of size >= 4GB (a mostly invisible change; for solvers, this requires ASLdate >= 20060122). 20060430 Arrange for presolve to turn logical constraints into algebraic constraints (when deductions make this possible), and then to process the new algebraic constraints. New builtin params: _nlog_algcons = number of logical constraints turned by presolve into algebraic constraints _npre_log_algcons = number of such constraints subsequently eliminated by presolve. These numbers also appear in the output for "option show_stats 3;". 20060725 Have "display" honor $display_precision when printing symbolic parameters having numeric values. When "expand" or "solexpand" prints out a constant objective, show its value as "number" or "-number" rather than "0 + number" or "0 - number". 20060905 When x is a variable, have "reset data x;" discard x's current value (and, as before, permit new default data for x's initial value in a data section). If x has a random default expression, it gets resampled when x is next needed. Previously, "reset data x" worked this way until x was assigned a value by "let" or "solve", after which x retained the assigned value. 20060912 New option csvdisplay_restrict: with $csvdisplay_restrict at its default value, an undocumented restriction on csvdisplay is henceforth relaxed. Specifying "option csvdisplay_restrict 1;" enforces the restriction in question, namely that csvdisplay issues an error message (meant to help debug GUIs that use csvdisplay) when asked to display more than one table. Example: set A{i in 1..4} = i .. i^2; csvdisplay A; # used to be disallowed option csvdisplay_restrict 1; csvdisplay A; # gives the old behavior: # complains "csvdisplay would emit 4 tables." 20061005 Fix glitches with imported functions: 1. If-then-else expressions in constraints and objectives with imported functions appearing only in the "then" or "else" expressions could result in a complaint about unavailability of the functions. They might be available to the solver, so no complaint should appear. Example: function exact; param p symbolic; var x >= 0 <= 10; minimize zot: (if num(p) == p then p else exact(p))*x; data; param p := '1234567890123456789'; write 0; # "Can't invoke unavailable function exact." 2. If an if-then-else expression in an argument to an imported functions evaluated by the solver had a non-constant numeric "then" expression and a string-valued "else" expression or vice versa, confusion resulted in that a numeric expression might appear where a symbolic one was expected. Example: function goo; var x; minimize zot: x*goo(x, if x >= 3 then 'abc' else x+10); # new diagnostic: "solve" or "write" now says # Cannot convert a numerical "then" or "else" to string # in if-then-else expressions that solvers must evaluate. 20061007 Fix bug in handling chains of comparisons involving more than 2 comparisons. Example: print{i in 1..2}: if 1 < i < i^2 > 3 then 'yes' else 'no'; # printed "no", then faulted 20061023 Fix an obscure bug that gave rise to error messages such as presolve has k = 167168, P.nfc = 166781 Tentatively introduce option presolve_logfile with possible values "filename" to write file filename anew each time presolve runs; ">>filename" to append to filename each time presolve runs; and "-" to write to the standard output file (stdout). When $presolve_logfile is not "" (its default value), each time presolve updates a bound, the constraint and variable involved and updated bound are written to $presolve_logfile. New builtin symbolic param _table_errmsg records the last error message from the most recent "write table" or "read table" command, and is set to "" if the last such command had no error. New option table_errbreak determines whether "write table" and/or "read table" commands report errors and terminate processing of commands, or suppress error reports and simply record the last error in _table_errmsg. $table_errorbreak (default 0) is the sum of 1 {suppress error reporting for "write table"} 2 {suppress error reporting for "read table"} 4 {for iterated "read table" and "write table" commands, do all iterations despite errors} Hitherto, $table_errbreak = 4 was the old behavior; now the default value 0 stops iterated table commands at the first error. 20061030 Fix a glitch in the display command's use of $n to stand for the heading of column n: sometimes the heading was '$n' rather than simply $n (unquoted), but the quotes were not accounted for, causing the headings not to line up with the columns beneath them. Now the erroneous quotes are gone. Example: set A; set B; param p{A,B}; data; set A := 'pumpkin pie' 'ice cream' 'chocolate sauce' 'vanilla cream' 'apple pie' strawberries; set B := 'New York' 'San Francisco' 'San Diego' 'Washington, D.C.'; param p : 'New York' 'San Francisco' 'San Diego' 'Washington, D.C.' := 'pumpkin pie' 12 13 14 15 'ice cream' 22 23 24 25 'chocolate sauce' 32 33 34 35 'vanilla cream' 42 43 44 45 'apple pie' 52 53 54 55 strawberries 62 63 64 65; option display_width 40; display p; # heading ended with "'$1' '$2' '$3' '$4' :=" # instead of with "$1 $2 $3 $4 :=" 20061102 Fix another bug with recursive set definitions. A fault revealed the bug, but wrong results without a fault might sometimes have been possible. 20061121 Add messages distinguishing "Solution determined by presolve" from "All variables fixed" and "All relevant variables fixed". (In the latter case, some unused variables are not fixed.) All these cases still get solve_result_num = 99. Have main() call exit rather than returning, to prevent a fault on an odd version of Linux. 20061130 Fix glitch with suffixes on random variables (a forthcoming addition). 20070222 Fix bug apparently introduced 20061005 in calling user-defined functions: numeric dummy arguments, such as i in "f({i in 1..3} i)", were passed to solvers as strings rather than numbers. 20070301 Fix glitch in "read" command introduced 20060314 that could cause an immediate "end of file" error message. Tweak to $csvdisplay_restrict: when $csvdisplay_restrict mod 2 == 1, provide a more detailed error message when csvdisplay would emit more than one table, unless $csvdisplay_restrict mod 4 == 3, in which case the former, one-line error message appears. 20070312 Fix bugs in handling variables declared "in Set_expression": integer and binary were not always properly distinguished when such variables could be turned into integer or binary variables; with "option presolve 0", the "in Set_expression" was ignored; and at one point in presolve, a test for reducing the domain of a variable using the "in Set_expression" was applied too soon, possibly causing variables to be fixed inappropriately. Examples giving rise to these troubles had the form var x in {0, 1, 2}; # or in {0, 1} for the third bug var y >= 1, <= 3; maximize obj: y; subject to r: y <= 2 * x; 20070317 Fix a bug with option single_step: if an error (such as a bad subscript) was reported during single-stepping, things were sometimes not properly cleaned up, possibly resulting in a subsequent fault. Addition to error messages for commands: the current _cmdno (the count of commands executed) is now reported unless input is from the standard input. For the standard input, setting option stdin_offset to 1 causes the input offset and _cmdno to be reported in error messages for commands. New option single_step_cmdno causes $single_step to be set large enough to cause single stepping when _cmdno == $single_step_cmdno. This provides a way to repeat the execution (after "reset;" or a fresh invocation) and enter single-step mode just before an error, to permit looking at current values, which might shed light on the error. 20070410 Add " 7 rand random variable in current problem" to $astatus_table. Fix bug in variable.astatus when there are unused defined variables. Example: var x; var y; var u = 4*x + x^2; # unused var z = 3*x^2 + y^2; var w; minimize zot: z + w; s.t. bletch: exp(z) <= 4.2; display _varname, _var.astatus; # showed "sub" rather than "unused" for u 20070505 Fix bug during "reset;" with handling at_exit() registrations by imported functions: they were lost. Fix bug in handling "table" declarations appearing before a suffix declaration (including implicit suffix declarations that result from "solve" commands in which the solver returns a new suffix), or that appear before certain "delete" commands: confusion, such as a fault or surprising error message, could result. Example: set I = 1..3; var p{I}; table pt OUT 'pt.tab': {i in I} --> [eye] , p[i]; suffix zork; write table pt; # "unexpected type..." Fix bug with multiple suffix declarations appearing after some other declarations and a delete command: a fault or other confusion was possible. 20070518 Fix a bug in presolve's handling of variables declared "in Set_expression". Such set expressions in general are unions of intervals (with point values included as degenerate intervals). If presolve deduced a bound that would eliminate more than one interval, it botched a bound update. Example: var x in {0, 2, 4, 8}; s.t. bletch: x <= 2; # the bug changed 2 to 4 maximize obj: x; 20070522 Fix handling of string expressions in "commands (...);" commands so ... can involve params declared with "= value" but not yet used in a command. 20070612 Tweak printing of sets under complicated conditions, such as error messages involving next() and prev() under obscure conditions in which the sets are now shown as a list of elements, enclosed in braces. Previously the braces were omitted and the elements printed one per line, which was confusing. 20070618 Fix the bug noted in the second "solve" comment of var x; minimize f: func(x); let x := ...; solve; # with no primal or dual values returned, e.g., gjh redeclare minimize f: another_func(x); solve; # value assigned by "let" to x not transmitted. 20070712 Fix bug in handling imported functions that specify a domain for INOUT arguments with "..." indexing. For example, function f(Reals IN, ...(Reals INOUT)); encountered the bug when invoked, but function f(Reals IN, ...(INOUT)); did not. Fix a bug in simplifying certain complex logical expressions that led to the error message "unexpected type 0x11e03 in lsimplify()". Fix a bug with named problems that led to the error message "named_genall called". Fix a bug with "delete" and "purge": when applied to variables, constraints and objectives, they did not update problem declarations, which could have led to a fault or other confusion. 20070802 Fix a bug (infinite loop) in "redeclare set ..." when neither the old or new set is subscripted. Example: set S; var x{S} >= 0 <= 1; set F = {i in S: x[i] in (0,1)}; #error message redeclare set F; # looped Fix a glitch with "show p;" for a param p that had data supplied in a data section. Example: param p; data; param p := 1.7; show p; # mentioned "random" Fix a performance bug: reduce overhead when params and sets without constraints on their values are updated. 20070825 Fix a fault in handling "ordered by ..." in certain situations where ... is a set expression, such as a subscripted set. 20070903 In the breakpoint and slope lists of piecewise-linear expressions, i.e., the ... of <<...; ...>>, permit iterating parenthesized lists of expressions, as in function calls. Here is an example that is now acceptable, but formerly elicited a syntax error message: var x in [-15,15]; minimize zot: <<{i in 1..3} i^2; {i in 1..2} (-1,1)>> x; 20070923 Permit Infinity (as well as NaN) as values in data sections. Disallow deleting some suffixes not previously noted as system suffixes. System suffix stage was quietly introduced a while ago, for use with random variable declarations (a forthcoming extension). Permit explicit declaration of suffix stage if no random variables have been declared, which disallows subsequent declarations of random variables and permits using stage as an ordinary declared suffix. 20071007 Adjust computations behind "Too much memory used" message to make the message more accurate when sbrk(0) proves to be unreliable. 20071111 Fix bug in handling variables unused in the current problem when defined variables (also unused) were present that depended on the unused variables, the unused variables and their defined variables were mishandled, such that commands involving them might see incorrect values. Example: var x; var g = x^3 - x^2 - x - 1; var gp = 3*x^2 - 2*x - 1; let x := 2; display x, g, gp; # OK so far let x := x - g/gp; display x,g; # botched values (It is more appropriate to use "param" rather than "var" in this example; doing so would have avoided the bug.) Fix a bug with redeclarations: a fault was sometimes possible. Example: set I; param p{I}; var f; param q; minimize zot: sum{i in I} (f*q^i - p[i])^2; s.t. zotc{i in I}: p[i] == f*q^i; delete zot; set J; redeclare s.t. zotc{i in J}: p[i] == f*q^i; # fault 20071121 Fix bug with "ordered by": a fault was possible under the "right" conditions, as in this example: set A ordered; param p{A}; set S ordered by A default{i in A: p[i] == 0}; data; param :A: p := a 0 b 1 c 0 d 2; display S; # faulted 20071222 Banish an obscure error message "unexpected subtype 23 in sforce". Fix fault with "let Set := (expression involving the Set)", e.g., set A default {}; for{i in 2..4} { let A := A union {j in i .. i^2: j in i+2..i+3 diff A}; display A; } 20080102 When a constraint implies a bound on a variable and integrality of the variable causes a further adjustment to the bound, do not treat the constraint as tight when inferring dual values. Before this change, constraints eliminated by presolve were sometimes given nonzero dual values, even though they were slack. Tweak ODBC table handler so (e.g.) with MS SQL Server it will choose a better type for numeric data. 20080128 Fix a bug giving an erroneous "no data" message in the following: set I = 1..3; minimize zot; var x{i in I} integer >= 0 obj zot i; set S; s.t. zap: sum{i in S} x[i] = 1; let {i in 2..3} x[1].relax := 1; # no data for S let S := 1..2; solve; 20080202 Fix another bug giving an erroneous "no data" message under some circumstances when a defined variable is involved in column generation. Example: set I = 1..3; minimize zot; var x{i in I} integer >= 0 obj zot i; var y obj zot 3 = x[3] + 1; set S; s.t. zap: sum{i in S} x[i] = 1; let {i in 2..3} x[1].relax := 1; # no data for S let S := 1..2; solve; Fix a fault arising in a complicated use of defined variables. 20080207 Fix a bug that crept in sometime in printing certain expressions, such as iterated piecewise-linear terms. The bug gave rise to error message "unexpected type 0x1e600 in prex()". Example: var x{i in 1..3} := i; display {i in 1..3} <<{j in 1..i} .5*j; {j in 0..i} (-j)^j>> x[i]; 20080216 Fix a bug (fault or worse) connected with a subscripted defined variable whose indexing set changes size sufficiently to elicit the bug. This also corrects a related (so far not seen) bug with "expand" and ".astatus" of partially dropped constraints. 20080219 Fix a bug in handling iterated slopes and breakpoints in piecewise-linear terms. When it bit, the bug led to a surprising error message, or worse. 20080306 In interactive mode with stdin on the current include stack, have "include 'unavailable'" return to the command prompt (to reading stdin) when file 'unavailable' does not exist. Fix a bug (fault) in printing the error message "bad subscript (use before def?) for defined var ..." under the "right" conditions. 20080307 New variant -Rw of command-line option -R (described in change-log entry for 19970814) disables output redirections ("> filename" and ">> filename"). 20080312 Fix bug in expressions involving the dual value of a subscripted constraint after earlier subscripts of the constraint were dropped, and in writing initial guesses for such constraints in .nl files. New option ampl_libpath specifies a sequence of directories, one per line (analogous to $ampl_include) in which to look for libraries mentioned in "load" commands. When $ampl_libpath is empty or contains only white space, the "load" command looks in the current directory. (The "unload" command looks for names mentioned in previous "load" commands and quietly ignores names not found; "reload" is a combination of "unload" and "load", so it honors $ampl_libpath when doing its "load". Note that $AMPLFUNC and the builtin sets _AVAILFUNCS, _AVAILFUNC2, _LIBS are updated by "load", "unload", and hence "reload".) 20080314 Fix another bug in writing dual initial guesses to .nl files when there are subscripted constraints, some of which have been partially dropped. An invalid .nl file could result. 20080423 New builtin params _last_solno, _primal_solno, _dual_solno, _status_solno: _last_solno is incremented at each "solve" and "solution" command that reads at least some solution information. If any primal or dual variable or solver status (.sstatus) values are read from the .sol file, _primal_solno, _dual_solno, and/or _status_solno, respectively, is/are set to the new _last_solno value. If "solve" results in "Solution determined by presolve" or "Infeasible constraints determined by presolve", these parameters are also updated. 20080616 Adjust reporting of memory used to avoid confusion under some 64-bit versions of Linux where there can be large gaps in the addresses returned by malloc(). This change affects the memory usage reported with "option times 1;" and "option gentimes 1;". Fix a bug in handling defined variables fixed by presolve: linear variables were sometimes reported as nonlinear. Example: var x; var y = x + 1; var z = 2*x + y; s.t. c: z = 12; var w; minimize zot: w; # erroneously reported to have # a nonlinear variable and nonlinear constraint 20080629 Fix a bug in use of variable values in set expressions (which can only happen in commands): if previous changes caused indexing of some variables to change and nothing had since caused the "collect" phase to run again, wrong values were sometimes used. In the very complicated example that led to finding this bug, an inserted "display" changed some behavior (because it caused the "collect" phase to run). With the fix and "option times 1" to show phases, you will still not see "collect" running before a command that does not need it, but correct values are now computed. Further adjustment to reporting of memory used to avoid negative values. Write "Solution determined by presolve" messages to stdout rather than stderr. New builtin solve_result_num values: 999 ==> error running solver (nonzero solve_exitcode); 998 ==> nonexistent .sol file; 997 ==> error in .sol file; 996 ==> error in restoring state to read .sol file. Treat any of these as exit code 1024 from the solver as far as option solve_exitcode_max is concerned. (The default value of 0 for $solve_exitcode_max will then cause a break in the execution of commands.) This applies to both "solve" and "solution" commands. (Of course, solve_result_num cannot be set to 999 by a "solution" command.) 20080701 In some cases of failed "solve" and "shell" commands, report where in what input file the error occurs. 20080703 Tweaks for stochastic programming extensions (to be described later). 20080717 Fix a bug introduced in version 20080616 in the handling of nonlinear defined variables, e.g., those used in both constraints and objectives. Example: set I = 1..2; var x{I} := 1; var y{i in I} = x[i]^2 + i; minimize zot: sum{i in I} (y[i] - 4)^2; s.t. foo: sum{i in I} y[i] <= 7; 20080804 Fix a bug introduced in version 20060905 in which "update data", like "reset data", discarded current values. Now current values are gain retained by "update data". Example: set I = 1..2; var x{I}; param p{I}; minimize zot: sum{i in I} (x[i] - p[i])^2; data; param p := 1 1 2 2; solve; update data; data; param p := 2 5; print sum{i in I} (x[i] + p[i]); # printed 6 rather than 9 New params (mainly for use in debugging carelessly written models): _backslash_map default 0; # 0 ==> no mapping # 1 ==> map \\ to / _filename_case default 0; # 0 == retain given case # 1 == force to lower case set _file_prefixmap dimen 2; # for (a,b) in _file_prefixmap, map prefix a to b Note that under MS Windows, you have always been able to use / instead of \ in file names. Use of \ causes gratuitous unportability. 20080812 Fix a bug in declared suffixes assigned value zero. The bug only bit sometimes; a reliable, simple example of the bug is elusive. 20080821 Fix a glitch that caused mention of unused imported functions in .nl files when expression simplification (such as multiplication by zero) caused removal of all references to the functions. Example: function ginv; function hypot; set I = 1..2; var x{I}; var y{I} >= 0; s.t. bletch: sum{i in I} y[i] <= 0; minimize foo: hypot({i in I} (x[i] - i)) + y[1]*ginv(y[2]); # ginv was listed as required in the .nl file, # even though presolve deduces y[1] == 0 and no actual # reference to ginv appears in the .nl file. Fix a glitch with "delete option ...". Example: option zork 'some value', zork; delete option zork; option z*; # said option zork ''; # not defined # after the bug fix, "option z*;" does not mention zork at all.