*** Complete AMPL fix and change log *** Below is a summary of AMPL bug fixes and changes from 30 Nov. 1992. 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 To get the current version of this file, ask netlib to send fixlog from ampl Here is a summary of bug repairs and changes. Each block of changes is preceded by the version (yyyymmdd) in which the changes first appeared. 19921130: Fix bug with option omit_zero_rows: numeric set members were sometimes treated as zero. Example: option omit_zero_rows; display{i in -3..3} i; 19921210: Fix bug with print and printf illustrated by print{1..3}: 1; which only printed 1 once. Fix bug in detecting common expressions in function arguments. Example: function nfcall(); print{i in 1..3} ncall(); used to print "1 2 3"; now prints "1 1 1" (where ncall returns its invocation count -- it's one of the examples in the sample funcadd.c). 19921216: Fix horrid bug in (and following), e.g., assignment to a new param of computed values involving a variable other than the first-declared variable. 19921218: Fix possible memory fault with objective.invalid_suffix. Fix possible confusion that might have resulted if changed data caused constraints, objectives, or variables to be regenerated after some components were dropped or fixed. For now [until 19930813], partial drops and fixes are forgotten when an entity is regenerated. Complete drops/fixes ("drop foo;" or "fix goo;") are still honored. 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 19921221: Fix bug in linearizing "easy" piecewise-linear terms (convex terms in minimizing objectives, concave in maximizing, etc.) with negative breakpoints. 19921231: Fix bug in ampl -omfoo model steel.mod; data steel.dat; solve; write; # "solve;" had destroyed command-line outopt setting Fix bugs in reset data and reading data for parameters that have a default. Example: set A := 1..3; var x{A}; param b{A} default Uniform01(); minimize zot: sum{i in A} (x[i] - b[i])^2; solve; data; param b 2 27; # no complain about b already having # a value computed from its default reset data b; solve; # the model was not instantiated anew Adjust "update data" command to retain previously computed default values unless explicitly assigned in a subsequent data section. This mainly affects random default values. Fix bugs in the error messages for parameters that have previously computed default values and (absent "update data" permission) are given new values in a data section. 19930103: Fix bugs with params that have a default that gets evaluated before a data section provides values for some other components, e.g.: param p{1..10} default Uniform01(); display{i in 9..10} p[i]; data;param p 1 3 2 37; display p; # wrong values for p reset data p; display p; data; param p 3 23 5 42; display p; # memory fault 19930111: Fix obscure bugs: (1) If let or a data section changed a variable that had been fixed by presolve, subsequent solve commands (without some other intervening event to provoke running presolve again) did not restore the variable. Example: var x; var y; minimize obj: (x - y)^2; c1: x + y >= 7; c2: x = 0; let x := 9; let y := 11; # x correctly set to 0 solve; display x,y; let x := 9; let y := 11; solve; display x, y; # x was left at 9 (2) Constraint.body (etc.) values were not correctly computed after "let" or a data section changed a variable that had been fixed by presolve and appeared nonlinearly in the constraint, and similarly for objective values. Adjust logic for deciding if "solve" needs to rewrite the .nl file (e.g. after a "write" command). Previously, changes to variables by "let" examined $reset_initial_guesses at the time of the let command; now ampl notes that there are changes, and examines the state of $reset_initial_guesses and $dual_initial_guesses when it is time to consider rewriting the .nl file. Fix bug with "show" revealed in var x{1..3}; minimize zot: sum{i in 1..3} (x[i]-i)^2; solve; display x; show x; display x; # wrong values 19930112: Fix infinite loop that could result from typing "end" (rather than "quit") after certain error messages. Keep end-of-file in data mode from causing instantiation of the current problem if commands have been seen. 19930114: Fix bug with -on (or option outopt n...). 19930119: Fix bug revealed in var x{1..2}; minimize obj: sum{i in 1..2} (x[i] - i)^2; solve; show x; let {i in 1..2} x[i] := 10; # memory fault Fix bug revealed in var x{1..4}; let {i in 1..4} x[i] := i; # rhs = unadorned dummy variable display x; # wrong values Tweak some details of printing by "show": no more ".if." or "recpd."; show recursive parameter defs with := rather than "default" (when the declaration specifies :=). Adjust rule for making "if" symbolic or numeric. This should be invisible, except that var x{i in 1..4} := if i = 1 then i else x[i-1]+2; now elicits an error message about "variable in := expression". 19930126: Adjust solve command to notice changes in $reset_initial_guesses and $dual_initial_guesses since the last write command. Fix bugs in update data: 1. Some derived sets were not cleared properly. 2. Check statements were not run again after data updates. This could cause some derived sets not to be recomputed. 19930213: Coerce if (expression involving variables) to if (expression != 0) rather than complaining about variables in a logical expression. Supply missing subscript in error message for set A; param p{A}; data; param p := a 1 a 2; 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). 19930209: Adjust interlocks so changing option var_bounds after a write command will cause a subsequent solve command to write temporary files (to pass the alternate variable bounds to the solver). 19930303: Fix glitch in constraint.lb, .ub, .lbs, .ubs: constraint.lb and .ub do not require presolve, .lbs and .ubs do. 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. Fix bug (memory fault) in use of constraint[subscript].suffix before a solve or solution command. 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. 19930311: Fix some bugs in handling defined variables after "let" changes the problem's size. 19930315: Fix bug (giving error msg "invalid refct 0 in opgen") revealed in param M{1..2}; param t := M[1] / (M[1] + M[2]); param n := M[1] + M[2]; param p{1..n} := Uniform01(); var x{i in 1..2}; minimize zot: (sum{i in 1..2} (sum{j in 1..n} p[j])* (x[i] - M[i])^2)/(M[1] + M[2]); data; param M := 1 1 2 2; print zot; print t; let M[1] := 3; print zot; 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". 19930319: Fix bug after the message "Ignoring solve command because presolve finds no feasible solution possible." Neither reset nor drop cleared the "infeasible" flag. 19930331: Fix bug in printf's handling of %e, which rounded to one too few decimal places. 19930406: Fix bug (mix-up of convex versus concave) in linearizing piecewise-linear constraints. Convex <= constraints had integer variables added unnecessarily, and convex >= constraints did not have them added. Fix a bug that currently only matters to osl when a problem contains some piecewise-linear terms that require adding integer variables and others that do not require this. 19930409: Fix horrid bug in handling slices after "let" or "reset data" changes the slice's base set. Some slices were not recomputed. Example: set A dimen 2; set I := setof{(i,j) in A} i; set B{i in I} := {(i,j) in A}; data; set A := (a,b) (a,c) (b,c); display B; reset data; data; set A := (a,y) (w,z); display B; The second display printed set B[a] := b c; set B[w] := ; # empty rather than the correct set B[x] := y; set B[w] := z; Fix a bug that sometimes appeared after reset data when e.g. variables or constraints are indexed over a setof or over a union or subscripted set whose size was a power of 2. 19930421: Fix bug in "let" assigning 0 to a param after an error message about the param not having a value. 19930422: Fix rare memory allocation bug that might be encountered with printf format %.24e (on systems with 32-bit ints; for 16-bit ints, %.16e could elicit the bug). [For the MS-DOS Student Edition, AMPL.EXE has 32-bit ints, and AMPLC.EXE has 16-bit ints.] 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. Fix botch with printf %wg (w = integral width): integers had as many extra spaces as trailing zeros. 19930514: Added an fflush(stderr) that affects placement of error messages in invocations like ampl foo >goo 2>&1 and ampl -v2 2>foo (which should result in an empty foo). Fix bugs revealed in c1: to_come = 1; param p; var x coef c1 p := 1/3; data; param p := 3; let p := 2; print c1.body; print p; print x; #garbage and model prod.mod data prod.dat solve; reset data; data prod.mod # wrong file reset data; data prod.dat solve; # memory fault Arrange for errors that stop genmod to terminate current file inclusions (as other errors do); close the files involved. Close current input file right after EOF, rather then just before opening a new (command-line) input file. 19930515: Adjust logic so "let" can reference current variable values without instantiating an updated problem instance (which could elicit complaints about missing values -- being supplied by "let"). Avoid a memory fault when a command references an unavailable subscripted set after the first error message about its absence. 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. 19930521: Fix bugs with "objective" and "drop" that caused these commands to be ignored when applied to simple objectives or constraints involving to_come, net_in, or net_out. Fix bug in option Cautions, which did not suppress Cautions about multiple "to" and "from" clauses issued during genmod. Modify printing of objectives (by "show" and -M) so minimize cars; prints as on the previous line, rather than (the equivalent) minimize cars: 0 + to_come; 19930609: Fix memory fault revealed in the sequence model diet.mod data diet.dat reset data; data diet.mod # elicits many error messages reset data; # memory fault 19930615: Fix bug in writing .fix file: if the .unv file was not requested and there were unused variables, they went into the .fix file. Fix bug in reporting values of unused variables: they were reported as having their initial guess, which might be infeasible (i.e., might not satisfy their bounds). Now they're adjusted to be in bounds. Use stronger deduced variable bounds rather than declared variable bounds in deciding whether an integer variable is binary. Fix error message that complains about duplicate entries in subscripted sets read in a data section: the subscripts were wrong and could cause a memory fault. 19930616: Fix bug in printing the subscript of an indexed set in certain error messages. Example: set A; set B{A}; set C := union{i in A} B[i]; param p{C}; data; set A := a b; set B[a] := 1 2; # no set B[b]; display C; # Bus error while complaining about B[b] 19930630: Fix bug introduced 8 Feb. 1993 (with relax_integrality, version 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 19930702: Fix bug (e.g., memory fault) sometimes revealed in solve; display foo; where foo is a simple or indexed variable, none of whose components are used in the model. 19930711: Fix bug with defined variables: they were not recomputed after "let" should have caused them to change. Fix bug in recompiling "if" expressions whose "then" or "else" clauses involve variables. Recompilation is necessary after some "let" and "reset data" commands. 19930711: Fix bug in restoring variable values when regenerating an instance (e.g. after "let") whose model has defined variables declared before some non-defined variables: the subsequent non-defined variables got some wrong (seemingly random) values. 19930712: Fix bug with -L (option linelim 1): nonlinear uses of a linear defined variable did not cause the right-hand side variables to be recorded as nonlinear variables. Example: var x; var y = x + 4; var z = y^2 + 2*y + 1; minimize zot: z^2; # x not recorded as nonlinear # bug caused gradient == 0 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. 19930813: Change ">=" to ">" in error message "lower bound = ... > upper bound = ...". Fix nasty bug with dropping only some components of an indexed constraint: unless only the final constraints were dropped, the constraints got the wrong left- and right-hand side bounds. Arrange for $relax_integrality to apply to declared bounds (which formerly got rounded to integer, even if option relax_integrality 1; was specified). Apply $presolve_inteps to the rounding of bounds declared with variables (when $relax_integrality is 0). Fix memory fault (or worse) occasionally seen after drop or restore. Omit interlock that gave the message "x.rc cannot be used until after a solve or solution command", which (confusingly) could be circumvented by displaying x.rc first. Stop iterated "let" at first invalid left-hand side subscript. Adjust bounds on integer variables to tightest available bounds (thus always passing bounds of 0 and 1 for variables that the solver is told are binary variables). Retain dropped status of constraints, fixed status of variables, and current values of scalar variables and dual values of constraints when the problem changes. (Current values of subscripted variables were already retained. Dual values were previously discarded.) 19930901: Fix memory fault in set S := {1..5} cross {3..9}; display {(i,j) in S: i=j}; display {i in 1..5}: {(i,j) in S}; # memory fault Fix optimization bug: constraints or objectives involving a context of the form {i in A, j in B: condition(i,j)} and a linear expression of the form ("constant" expression involving i but not j) * (expression involving variables) did not have ("constant" expression involving i but not j) re-evaluated when i changed but condition(i,j) was false for the first j in B. Example: param p{i in 1..2, j in 1..2} := 10*i + j; var x{i in 1..2} >= 0; minimize zot: sum{i in 1..2, k in 1..2: k > 1} (sum{j in 1..2} p[i,j]) * sum{L in 1..2} x[L]; Also fixed: memory fault when the above example is fed to "ampl -O". 19930914: Fix bugs in handling "if" expressions yielding symbolic (character) values used as arguments to functions involving variables (i.e., functions that the solver must evaluate). Example: function foo; var x; minimize zot: foo(x, if x > 3 then 'abc' else 'def'); Fix bug in handling defined variables whose right-hand sides involve (linear occurrences of) piecewise-linear terms when option pl_linearize has its default value 1. Fix storage-overwriting bugs that sometimes arose when an entity was indexed over a set whose cardinality changed from 1 to some larger value (as a result of "let" or "reset data"), or when the set over which a defined variable is indexed similarly got (sufficiently) larger. Add automatic differentiation facilities for computing reduced costs of variables in nonlinear problems (and dual values of definitional constraints and constraints eliminated by presolve). This eliminates the old message "Ignoring nonlinearities in computing dual values for constraints eliminated by presolve." 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. 19930922: Fix bus errors and erroneous "bad subscript" messages revealed by param n integer >= 0; set S := 1..n; set T; param p {T,S} >= 0; check {i in T}: sum {j in S} j * p[i,j] <= 2; var x{S,T} >= 0; minimize zot: sum{i in S, j in T} x[i,j]; data; param n := 0; set T := a b c; let n := n + 1; let p['a',n] := 1/n; let{j in T: j != 'a'} p[j,n] := 2/n; solve; [The "check" first executes at the first "let", then again at the "solve"; there was a bus error in preparing this second execution of the "check". There was also a bus error associated with the references to n in commands after n had been incremented. And there was a bug in handling sets like S that go from being empty (n = 0) to having members.] 19930928: Fix bug in handling a variable indexed over a computed set: if the set changed and had to be recomputed before the variable was re-instantiated, saved values could be wrong and (if the set got sufficiently bigger) a memory fault could result. Example: param n default 2; set S := n..n+2; var x{i in S}; let{i in S} x[i] := 10*i; display x; let n := n + 1; display S; # forces S, but not x, to be recomputed display x; # wrong values -- subscripts not adjusted Fix bug in subscripts shown in error messages for failed check clauses in param declarations (for params with values given in a data section). Apply $solution_precision and $solution_round to dual as well as primal solution values. Fix printf buglet: printf "%04.2d\n",3 printed 0003 rather than 03. Fix a bug in solving a problem, increasing the index set of a variable beyond the next power of 2, and solving a modified problem. Fix bugs in combining "option presolve 0" with "fix" and with "fix" before "let", "solve", or "solution" changes variable values. Example: var x{1..2} >= 0; minimize zot: sum{i in 1..2} i*x[i]; s.t. convex: sum{i in 1..2} x[i] = 1; let x[1] := .3; fix x[1]; # was ignored if previous "let" was omitted option presolve 0; solve; # Memory fault; --------------- 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. 19930930: Fix unlikely bug in constraints omitted by an "indexing" of the form {if false_expression}: the bug only appeared if certain virgin memory was nonzero in the right way. Fix bug in handling variables in flow-of-control tests before any solve, write, solution, or printing command. Example: var x; if x > 0 then print 'Yikes!'; Fix long-standing memory-overwrite bug in "show" (when listing the names of all entities of a class, such as all variables or all constraints) that only bit occasionally. 19931005: Fix bug in recovering dual values for constraints eliminated by presolve when $solution_round or $solution_precision caused the solution to be rounded: the rounding occurred before the dual values were computed, sometimes leading to wrong decisions about which constraints were active. 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;". Fix bug in computing constraint.ldual and constraint.udual for constraints after the first one: the decision whether to the constraint is binding was in error and could memory fault. Fix bug in handling constraints and objectives declared with syntax errors: references to them were botched. Fix memory faults with various variable.suffix and constraint.suffix notations before the first solve or other command that caused the model to be instantiated fully enough. 19931006: Fix bug in handling ord(dummy), next(dummy), prev(dummy), next(dummy,n), and prev(dummy,n) after "reset data;". Example: set S ordered; set T := {i in S, j in S: ord(i) < ord(j)}; data; set S := A B D; display T; reset data; data; set S := A B C D; display T; # complained that B was not in S. Forms that explicitly specify the set involved were handled correctly, e.g.: set T := {i in S, j in S: ord(i,S) < ord(j,S)}; 19931012: Arrange for errors in "let" commands to terminate all "for" and "repeat" loops. Fix bugs in use of "first", "last", "card" in "for" and "repeat" loops. Fix bugs in "ordered by" for sets given values in a data section. Example: set A ordered; set B ordered by A; data; set A := a b c; set B := b c a; display B; # memory fault Fix bug in "update data S" where S is a set. Example: set A; set B default A; data; set A := a b c; display B; update data B; data; set B := c a; # erroneous complaints of duplicate members display B; Under option relax_integrality, infer a lower bound of 0 and upper bound of 1 for binary variables. Fix bug in handling sequence "if ... then {...} if ...": the second if should cause the first to be complete (have a null else part). Example: if 1 > 2 then print 3; if 4 < 5 then print 6; else print 7; should print 6; with the bug, it did nothing. Fix bug that caused default expressions not to be evaluated in situations with incomplete "if" commands. Example: param p default atan(1); param p; if 1 < 2 then display 3; let q := p + 1; # memory fault Fix bug in handling dropped constraints after "let" or "update data" causes changes to some constraints. The dropped constraints came back into the problem. 19931018: Fix bug in references to variable.lb or variable.ub for hitherto unreferenced variables (after, e.g., "solve" or "display" has caused some entities to be instantiated) that do not appear in any constraints or objectives. Fix memory overwrite bug sometimes seen in displays involving more than 4000 characters. 19931022: Fix an obscure bug that arose in a complicated "display" before "solve" indirectly involving "prev" or "next". A simple example seems hard to create. 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". Fix bug (memory fault) introduced 6 Oct. 1993 in handing some next() and prev() references. Fix bug in handling sets involving dummy variables instantiated by for{...}. Example: for{i in 2..8 by 3} print{j in i..i+2} j; formerly printed "2 3 4" thrice. 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. Fix bug (perhaps introduced 13 Oct. 1993) in checking changes to subscripted sets that are ordered by or within another set, and which have a different number of subscripts than their dimension. 19931201: Fix memory fault in param p symbolic; let p := 3; # core dump Correct offsets in error messages in PC versions (which with some compilers were corrupted by MS-DOS's \r\n idiocy). 19931203: Fix bug with "let" commands inside "for" or "repeat" loops, when "let" assigns the same set to two or more other sets. Adjust error messages to mention the command being executed (and, if the command came from a file, to mention the file, line number, and offset) when an error occurs in a flow-of-control context, such as a loop. 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). 19931205: Tweak error message for aborted solve commands on Unix systems. 19931206: Fix memory fault in referencing (e.g.) an indexed param after "update data" if the param had no value before "update data". Example: set A; param p{A}; update data; data; param :A: p := a 1 b 2; display p; # memory fault 19931217: Fix bug in handling card, first, last in certain complicated situations. Example: set A; set B{A}; param p{i in A} := sum {j in B[i]} card({i} union {j}); # memory fault when p was instantiated Fix some memory leaks in solving sequences of problems. Fix memory fault that resulted when $log_file was initially set. 19931220: Fix glitch in changes of 13 Nov. 1993 (version 19931113) that caused the second solve in the following (pathological) example to have optimal value 3 rather than 6: var x >= 0; param a := x.val; maximize obj: x; subject to con: x <= a + 3; solve; solve; Fix an obscure memory fault. Change $show_boundstats to $show_boundtol. Retain dual values deduced for constaints eliminated by presolve. They were hitherto lost when a new problem was instantiated. 19931230: Fix memory fault in "reset data;" introduced in version 19931113. 19940103: Fix glitch introduced in 19931203 in the file name reported by error messages: in the invocation ampl foo - error messages for commands issued from stdin claimed to be in file foo. 19940113: Fix bug that prevented drop and restore from recognizing objectives. 19940119: Fix erroneous printing of a file name in error messages for commands typed on stdin after "reset". Fix occasional omission of file name from error messages (under complicated circumstances). Adjust a presolve error message so var x; fix x := 2; s.t. zot: x^2 <= 3; solve; gets the error message all variables eliminated, but upper bound = -1 < 0 rather than no variables, but lower bound = -Infinity, upper = -1 which is now reserved for constraints like s.t. zot: 0 <= -1; 19940128: Fix bug (possible loop or worse) in handling decimal numbers with an outrageously negative exponent field, such as 1.8826e-512. Adjust hashing to work better on {1..25,1..25,1..25,1..25}. Add column headings to output for -t and -T, and added incremental memory column to -T. Fix memory fault resulting from an attempt to display something about a hitherto unused variable after "solve". Example: var x; var y; minimize zot: (x-2)^2; solve; display y.lb; Fix rarely seen bug in the interaction of option show_stats and redirections on printing commands: if a printing command forced presolve to run (with "option show_stats 1" in effect), the redirection got lost and the printing went to stdout. 19940203: Fix bug that appeared under circumstances for which giving a short example seems hard: after a "solve" and printing variables that only appear in dropped constraints, printing components of some variables (before a display that printed all their values) sometimes showed the wrong values for them. Under similar circumstances, a memory fault (or worse) was possible with nonlinear defined variables. Fix possible memory fault in card expressions that involve a dummy index for a collection of constraints, objectives, checks, column generation syntax, or iterated function arguments. Example: set A; param p{A}; set B; var x{A,B}; s.t. zot{i in A}: sum {j in B} x[i,j] = card{j in A: p[j] = i}; # zot suffered a memory fault in "compile". 19940207: Fix an obscure memory fault illustrated by set P := 1..2; param d { P,P }; set PP := {P,P}; s.t. symmetry {p1 in P, p2 in P}: d[p1,p2] == d[p2,p1]; # Silly constraint: should be a check. var phi { P } >= 0; minimize pot: phi[1]; for{i in 1..2} { for {(p1,p2) in PP: p1 <= p2} { let d[p1,p2]:= Uniform01(); let d[p2,p1] := d[p1,p2]; } display symmetry.slack; # fault when i = 2 } 19940208: Fix bug introduced in 19940128 in handling subscripted sets of arity >= 2 and more than 16 elements that are only used for membership tests: the membership tests could come out wrong. Example: param n integer > 0; set A{1..n} dimen 2; set B{1..n} dimen 2; set C{i in 1..n} := A[i] union B[i]; set D{1..n}; set E{i in 1..n} := {j in D[i]: (j,j) in C[i]}; #silly let n := 1; let A[1] := setof{i in 1..50, j in i-1..i+1} (i,j); let B[1] := setof{i in 45..130, j in i-2..i+2} (i,j); let D[1] := 40..55; display E; # erroneously empty; should be 40..55 19940210: Fix fault in use of next and prev in some contexts. Example: set s circular := 1..7; param b {s}; let {i in s} b[i] := i; let {i in s} b[i] := b[next(i)]; # segmentation fault Fix remotely possible bug with option log_file and "reset;". 19940217: Fix obscure bug with output style 'm' (option outopt m... or command-line option -om...): initial guesses (in the form expected by MINOS: "FR INITIAL" lines in the BOUNDS section) were omitted from MPS files for linear problems. Fix "solveout bug" message that could arise under complicated conditions with -L ("option linelim 1;"). Fix memory fault possible with -L and variables defined by a linear expression plus nonzero constant. Fix bug, under -L, with nonlinear defined variables that have linear terms and are only used linearly: if there were no nonlinearly used nonlinear defined variables with linear terms, an erroneous .nl file resulted (and ampl could fault). Fix possible error associated with options OPTIONS_IN and OPTIONS_INOUT in the file name shown in error messages for commands. Fix bug in interaction of option outopt (or the write command) and certain display commands that could cause extra work (an an extra display of presolve statistics if "option show_stats 1" is in effect) when the session ended with end-of-file (rather than a quit command). 19940303: Continue execution when either $OPTIONS_IN or $OPTIONS_INOUT is unreadable at the start of execution. 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: Fix possible memory fault under "ampl -M" with cross products. Example: set ORIG; # origins set DEST; # destinations set PROD; # products set orig {PROD} within ORIG; set dest {PROD} within DEST; set links {p in PROD} := orig[p] cross dest[p]; Side effect: A cross B now prints as A cross B rather than {A,B}. Turn {A cross B} into {A,B}. Do not let "let" assign set values of the wrong arity. Fix bugs with "reset data foo;", where foo is a variable or constraint (a rarely used feature: updating .init and .init0 values). Avoid generating unused variables in response to printing commands (that leave the variables unused). Allow "let S := {};" for sets S of arbitrary arity. 19940329: Fix bug in handling if expressions involving a symbolic then and numeric else part, or vice versa: coerce the numeric part to symbolic, rather than vice versa. 19930401: Fix storage allocation bug revealed by complicated interaction of let with a variable indexed by a growing set. Example (from Leslie Hall, giving an erroneous error message about an invalid subscript): modified data for cut.run from Chvatal exercise 13.2b: param roll_width := 181 ; param: WIDTHS: orders := 21.625 90 20.5 51 20 45 17.25 11; 19930423: Fix error messages for "can't multiply ... by NaN" and "can't multiply ... by Infinity" to get subscripts in ... right. Fix error message for bad subscripts in column-generation notations (including arc declarations) to get subscripts right. Have the reset command close pipe functions. Fix bug in handling option commands after "solve" in loops: the name and value of the option were sometimes overwritten. Fix buglet that could force values returned by a solver subsequently to be forced in bounds when a subsequent "let" or "update data" causes more variables to be generated. This has a minor effect on example looping/multi.run (change by one in number of iterations in one of the solves). Allow any UTF character beyond the 7-bit ASCII characters to appear in names. Fix nasty bug in generating command prompts after "reset;": if command prompts for named loops were generated before the reset, such prompts generated after the reset could scribble on memory now being used for something else. Change prompt3 and prompt4 to cmdprompt1 and cmdprompt2. 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: Fix bug that, under rare conditions hard to describe, caused defined variables sometimes to have the wrong value after "let". 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. Fix some memory faults that were possible after "fix" and "objective" commands in problems involving defined variables. Fix a bug that sometimes kept presolve from running (again in examples involving defined variables). 19940605: Fix storage allocation bug with "reset data". The bug sometimes caused subsequent unpredictable results. Fix bug with "restore" and defined variables: if "restore" caused variables declared after variables referenced by the defined variables to be instantiated, incorrect linear terms were generated, possibly causing a "solve_out bug" message. Example: var x{1..2} >= 0; var w; var y{1..1} = sum{i in 1..2} i*x[i]; minimize zot: 3*y[1]; foo: 4*x[1] + 5*x[2] = w; goo: 6*w = 1; drop foo; drop goo; solve; restore foo; restore goo; solve; # solve_out bug! Fix bug in handling recursive params and sets that have a := clause. The := values were not recomputed when values upon which they depend changed. Example: param p default 3; param q{i in 1..2} := if i == 1 then p else q[1]*p; display q; let p := 4; display q; # Did not change. Complain about "reset data foo;" and "let foo[...] := ...;" and data- mode assignments to foo if foo has a recursive := clause. 19940608: Fix some obscure glitches in error messages. 19940610: Fix bug in handling {if lexpr} notation (in an objective or a constraint declaration, when the lexpr is true). Example: var x{1..2} >= 0; minimize zot: x[1] + 2*x[2]; s.t. C{if 0 == 0}: x[1] + x[2] == 1; solve; # memory fault 19940613: Fix possible botch when there is an indexed collection of objectives and an "objective" command appears (e.g.) before all variables have had to be instantiated. 19940616: Fix glitch in flushing buffers after control-C (i.e., SIGINT) or after a nonzero return code from a solver. The glitch was only apparent with invocations like "ampl filename). The bug could cause a memory fault or other untoward behavior in shell and solve commands. Fix failure to correctly instantiate variables under complicated conditions involving "fix". Example: var x{1..2} := 1; var y{1..2} >= 0 := sqrt(.5); circle: sum{i in 1 .. 2} y[i]^2 = 1; var z = x[1]*x[2]^2 + 1; minimize zot: (z - 5)^2 + (x[1]-2)^2; drop circle; # now y is not needed solve; display x, z; fix y[1]; # Forces generation of y, which, in this # example, caused confusion with z. A simple # "fix y;" did not cause any problem. solve; display x, z; # Results should be the same as before # but were not. (In a more elaborate example, # the second solve gave a memory fault.) 19940829: Supply missing newline in "difference = ..." lines from presolve. The newline disappeared during the changes for version 19940808. 19940901: Fix bug in writing .nl files for problems in which one defined variable appears exclusively in a single network constraint (node declaration), and another appears exclusively in a general constraint. The bug caused solvers to suffer a memory fault. Example: var w; var x = 2 - w; node foo: net_in + x <= 1; var y; var z = y + 1; goo: z >= 2; 19940908: Fix a bug that could bite when linearization of piecewise-linear terms increases the number of variables beyond the next power of 2. Adjust option command and $ notation to treat options (environment variables) for which AMPL does not provide a default as described in the AMPL book. For example, option PATH; now will show the current PATH (used in Unix and MS-DOS systems for finding the programs invoked by the solve and shell commands), rather than saying "option PATH ''; #not defined", and if you change option PATH, then you can now restore it to its original value by saying option PATH $$PATH; Fix (rarely seen) bug related to common expressions that appear in entities, only some of which must be recomputed after a change. The fix could cause some changes in -T (option gentimes 1) output. Example: param p default 1; param n integer >= 0 default 1; var x{1..n} >= p-1; var x1{i in 1..n} = x[i]*p; var y >= p-1 <= 2; var y1 = y*p; zot: sum{i in 1..n}(x[i] + y1) = 1; solve; let n := n + 1; solve; # fault 19940914: Fix memory overwrite possible with the sequence 1. Do something that generates a variable. 2. Change something that causes the variable to be regenerated, but with an error (e.g., failed check or bad subscript) that interrupts the regeneration. 3. Correct the mistake and regenerate the variable. Fix bug in simplifying nonlinear sums of two terms, the second of which can have a unary minus operation "moved up". (The bug was only possible if presolve fixed at least one variable, so turning presolve off avoids the problem.) Example: param p default 0; var x := -1; var y = if x < 0 then x + 1 / (p - x) else x; var z; fix_z: z = 0; minimize zot: y; 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; Fix memory fault in "reset data p" when p has no data but has been displayed. Example: param p{i in 1..3} default i; display p; reset data p; # memory fault Fix glitch in handling missing ; after final end-of-file: in data mode, no error message appeared. Fix bug in discarding invalid subscripts: if a data section supplied values for a param or indexed collection of sets, and the associated set of subscripts duplicated a valid set, the latter was corrupted. This bug could only bite when the -o command-line option caused an instantiated problem to be written out, as in ampl -ogfoo foo Example: set J; set K; param a{J,K}; param b{K}; param c{J}; var x{J}; minimize zot: sum{k in K} b[k]*(sum{j in J} a[j,k]*x[j])^2 + sum{j in J} c[j]*x[j]; data; set J := 1 2 3; set K := 1 2 3 4; param a : 1 2 3 4 := 1 1.1 1.2 1.3 1.4 2 2.1 2.2 2.3 2.4 3 3.1 3.2 3.3 3.4 ; param b := 1 10.1 2 10.2 3 10.3 4 10.4 ; param c := 1 11.1 2 11.2 3 11.3 4 11.4 # Discarding this bad subscript made all ; # values of subscript [4] disappear. Fix an unlikely trap due to an uninitialized floating-point value being read as a signaling NaN (or denormalized number on systems with faulty hardware or systems software) in the course of a "let" command that assigns a value for the first time to a subscripted param. 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. 19941005: Fix bug in handling repeat commands with omitted opt_until. Example: set A default {}; param p{A}; repeat {break;} display p; # memory fault Fix bug in { comandlist } within compound commands. Adjust some details of single-step mode. 19941007: Fix bug that caused default set expressions to be recomputed. Example: param p default 3; set S default p..p+2; display S; let p := 7; display S; # S was recomputed Change option omit_solmsg to solver_msg (default 1). 19941009: Fix glitch in "commands foo;" that kept commands following a compound command from executing. Diagnose premature end of file in "commands foo;". 19941028: Fix bugs in let commands assigning to a set or param that has a default expression when the set or param has not yet been assigned a value and appears on the right-hand side. Examples: param p{i in 1..3} default i^2; let{i in 3..3} p[3] := p[i] + 20; display p; # p[3] was 20 rather than 29 # did work correctly with p[i] changed to p[3] set T {1..4} default {}; let T[1] := T[1] union {"a"}; display T; # wrongly complained invalid subscript T[1] 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. Fix glitch in handling "option relax_integrality 1" when there are general (nonconvex resp. nonconcave) piecewise-linear terms. Fix bug leading to "tva top error" in the following example: param S; set A; param pmin{A} >= 0; param pmax{A} >= 0; param a{A}; param b{A}; param c{A}; # The consistency checks (>= ... and >...) on r # and L are necessary to elicit the bug. param r{i in A, s in 1..S} >= if s = 1 then 0 else r[i,s-1]; param L{i in A, s in 1..S-1} > if s = 1 then 0 else L[i,s-1]; data; param :A: pmin pmax a b c := a 2 16 12 2.4 3 b 5 25 103 3.4 2 c 1 5 24 1.5 5 d 10 54 105 1 5 e 1 5 1 5 0 f 0 13 16 2.4 3 g 0 22 107 3.4 2 h 0 5 28 1.5 5 i 0 51 109 1 5 j 0 5 1 5 0 ; param S := 6; for {i in A} # back to model/commands mode let r[i,1] := b[i]; ##The previous 2 lines would better be written ## let{i in A} r[i,1] := b[i]; ##but this did not reveal the bug. for {i in A, s in 1..S-1} { let L[i,s] := if pmin[i]=pmax[i] then pmin[i]+ .1*s else pmin[i] + (pmax[i]-pmin[i])/S * s; let r[i,s+1] := b[i] + 2*c[i]*L[i,s]; }; ##The above for loop would execute faster if written ## let{i in A, s in 1..S-1} L[i,s] := ... ## let{i in A, s in 1..S-1} r[i,s+1] := ... display r, L; 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; 19941030: Fix bug in reading sets in data mode after "update data": if two sets previously had the same value (and some command, such as "solve" or "display" gave occasion to check for sets having the same value), a data update to one changed the value of both, or (when both had default values) gave an erroneous error message about no data for the updated set. Examples: set A; set B; data;set A := ; set B := ; display A,B; update data A; data; set A := a b c; display A,B; # A = B (erroneously) reset; set A default {}; set B default {}; display A,B; updata data A; data; set A := a b c; display A,B; # erroneous message about no data for A 19941110: Arrange for $prompt2 to be shown for read commands inside general loop bodies. It was shown for for{i in 1..3} read p[i]; and the preferred read{i in 1..3} p[i]; but not for for{i in 1..3}{read p[i];} Fix glitch that sometimes caused "show" to mention set $display. Example: set A dimen 2; param p{A}; data; param :A: p := a b 1 b c 2 a c 3 ; option display_1col 1; display p; show; # sets: $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...". Fix memory fault in display of items with a declared index that is an ordered or circular subscripted set with no "by set" specification. Example: set A; set S{A} circular; param p{i in A, S[i]}; data; set A := a b; set S[a] := c d; set S[b] := d e; param p := a c 1 a d 2 b d 4 b e 5; display p; Fix bug with recursive symbolic parameters: if the value of such a param was another component of the same param, unpredictable behavior was sometimes possible. Example: set A circular; set B circular by A; param p{i in A} symbolic := if i in B then i else p[next(i)]; param q{B}; param r{i in A} := q[p[i]]; data; set A := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z; set B := B F G J P Q V; param q := B 1 F 2 G 3 J 4 P 5 Q 6 V 7; display r; 19941205: Fix error handling common expressions in some sequences of commands, such as: param p in [0,10] default 7; param q in [0,p] default 4; set Z default 1..p; set W default 1..q; # p is common to q, W, and Z. let Z := 1..3; display Z,W; # faulted evaluating [0,p] for q. Fix bug in sets involving random functions used in contexts that only involve membership tests. Example: set ZL := {1..5: Uniform01() < .3}; param p{i in 1..5} := if i in ZL then 0 else Uniform01() + 1; display p; # only requires testing membership in ZL display ZL; # forces ZL to be fully generated Fix bug in handling file redirections introduced with the read command. Unpredictable results could result from a memory-overwrite bug associated with redirections. Fix bug (introduced 28 Aug 1994?) in generating variables (without suitable data changes) that appear syntactically before previously generated variables. The bug could cause objectives or constraint bodies to be miscomputed. Example: var unused >= 0; var x{1..2} >= 0; convex: x[1] + x[2] = 1; var v; vdef: v = x[1] + 2*x[2]; minimize zot: v; solve; print unused; # appears syntatically before the other vars print zot; # wrong value 19941209: Fix bug in handling variables used as params (not used in any constraints or objectives). Instantiating them after a "solve" could cause a fault in a second "solve" if nothing has intervened to suitably change the problem. Example: var x{1..2} >= 0; var y; minimize zot: sum{i in 1..2} i*x[i]; s.t. convex: sum{i in 1..2} x[i] = 1; solve; let y := sum{i in 1..2} i*x[i]; print y, zot; solve; # fault Fix bug in handling repeat loops that appear at the end of the last input file and do not end with a semicolon. In one lengthy example, an infinite loop resulted. 19941212: Fix infinite loop in linearizing piecewise-linear terms for problems with both "easy" terms (not requiring integer programming) and at least one "hard" term in a constraint eliminated by presolve. Example: var x{1..2} >= 0; var y >= 0; minimize zot: sum{i in 1..2} i*x[i] + <<.7;3,4>>x[1]; s.t. convex: sum{i in 1..2} x[i] = 1; s.t. bletch: <<.5;1,2>>x[1] >= y; s.t. fix_y: y = 0; # presolve deduces that bletch always holds 19941220: Fix bug (e.g., memory fault) in regenerating variables after entities in their declarations, such as their index sets, have changed and the variables have participated in commands that do not require instantiating the entire current problem (i.e., most commands other than solution, solve, or write, unless dot notation forces the problem to be instantiated). Example: set A ordered; var x{A} >= 0 <= 10; minimize zip: sum{i in A} ord(i)*x[i]; var y{i in A: i != last(A)} = x[i] + x[next(i)]; s.t. zot{i in A: i != last(A)}: y[i] = 1; data; set A := a b c d; solve; reset data A; data; set A := g h i j; drop{i in {'g','h'}} zot[i]; solve; # fault Fix memory-overwrite bug with "update data": the sequence data; /* read one or more indexed params */ update data; # no use made yet of the params just read data; /* read more of the same params */ caused unpredictable behavior. 19950101: Fix bug that crept in sometime in or about fall, 1994: after data changes (e.g., "reset data" or "let"), objectives or constraints used with column-generation (including arcs) were sometimes miscomputed. Example: minimize cost; param p{i in 1..2} default i; var x{i in 1..2} >= 0 obj cost p[i]; convex: sum{i in 1..2} x[i] = 1; solve; # objective 1 (correctly) reset data; solve; # objective 2 (wrong! should be 1) 19950204: Fix bug in handling changes to option substout. Allow UTF-encoded Unicode in option names. Fix glitch in reading UTF in models on machines where chars are signed by default. Fix memory allocation bug that could appear after a message about discarding bad subscripts for a subscripted param (or set) that was given a single value in a data section, as in set A; param p{A}; data; set A := abc; param p := xyz 3; display p; Fix two bugs with option linelim 1: 1. Nonlinear defined variables involving an additive constant (nonlinear expression + constant) had the constant added twice to constraints, objectives, and other defined-variable values linearly involving the defined variable. Example (before bug fix): ampl: var x; ampl: var y = x^2 + 1; ampl: var z = 3*y + 4; ampl: minimize zot: y + z; ampl: option linelim 1; ampl: solve; MINOS 5.4: optimal solution found. 2 iterations, objective 19 # should be 8 ampl: display x,y,z,zot; x = -5.42101e-20 y = 1 z = 10 # should be 7 zot = 11 # should be 8 2. In a problem with nonlinear defined variables involving some variables linearly and only used linearly, the linear contributions to the nonlinear defined variable were added in twice. Example (before bug fix): ampl: var x; ampl: var y = x^2 - 2*x; ampl: var z = 3*y; ampl: minimize foo: y + z; ampl: option linelim 1; ampl: solve; MINOS 5.4: optimal solution found. 2 iterations, objective -30.25 # should be -4 at x = 1 ampl: display x,y,z,foo; x = 2.75 y = 2.0625 z = -10.3125 # should be 6.1875 (for x = 2.75): low by 6*2.75 foo = -8.25 # should be +8.25 (for x = 2.75) (Without a previous "solve", "solution", or "write", the display commands in the last two examples computed correct values from the original expressions.) 19950209: Fix a bug (introduced in 19941028) that could cause a memory fault in or after a "close" command. (With the bug, "close" commands are often harmless, which is why we didn't see the bug until now...) 19950211: Fix some memory leaks (visible with repeated "reset data" commands). Fix glitch that caused for {k in 1..10} commands foo; to read from stdin after reading foo (on every iteration). 19950307: Fix bug in handling partially dropped defining constraints. 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. 19950317: Fix memory fault in single-stepping when data turn up missing after an immediate command. Fix bugs in subscripted references to _varname, _conname, _objname, and to dot notation with subscripted _var, _con, _obj. 19950412: Recover somewhat better from floating-point exceptions. Fix glitch that prevented overriding builtin function names with problem names. Fix bug in an unadvertised check statement syntax: check {if lexpr}: lexpr1; Such checks appeared never to be tested. Now they are enforced. Fix bug that caused var x := 2; print x; to say "ungenerated variable x". Enforce the restriction that $values and synonyms (such as _VARS and _nvars) may not appear in declarations. Fix glitch that caused the script param p; var x; minimize zot: (x-p)^2; for{i in 1..2}{ let p := i; solve; display x, x.rc; } to give Error executing "let" command error processing objective zot: no value for p The problem was in handling dot notations (like x.rc) that require instantiating a model; the script ran correctly with the param p declaration changed to "param p default 0;". Abort reading commands from files other than stdin after detecting an error. Fix glitch that prevented the command following a command referencing an undeclared entity from being executed (when reading commands from stdin). For example, print c; # with c not declared print 3; # didn't execute Fix bugs in the Gamma and Poisson random function (a failure to retain values across calls that could cause them to compute wrong values or memory fault). Fix bugs in reading dual variable values for partially dropped constraints from .sol files (in the solve or solution commands), and in evaluating expressions involving dual values of dropped constraints. Fix glitch that (on some systems) could cause the error message "adjoin: SBUFLEN (bug!) is too small". Fix possible memory fault with single-stepping of break and continue commands. WATCOM binaries are now compiled to circumvent the Pentium divide bug. New xref command tells which entities depend directly or indirectly on specified item. Syntax: xref item_list opt_redirect; where item_list is a (white-space or comma separated) list of model entities and opt_redirect is an optional file redirection. Preliminary (and possibly still buggy) 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: Fix memory fault caused by evaluating variable.val before some command such as "solve" forces presolve to run. Fix bug in switching to a new environment with values that are set in the current environment but unset in the new one. Fix a bug (memory overwrite) in handling subscripted problems. Fix bug introduced in version 19950314 that made $solver_oopt (specification of output format for $solver) and $solver_auxfiles misbehave. Fix bug in handling subscripted objectives with differing constant terms: if some elements were dropped, the remaining (nondropped) ones got the wrong constant term (in the .nl file). This only affected objective values reported by solvers. Fix glitches in expand command that suppressed variables fixed by presolve and constraints removed by presolve; that was only supposed to happen for solexpand. Adjust the delete and purge commands to act on more than the first element in their itemlists. Allow items of the form "option opname" in the itemlist for delete. This removes opname from the current environment. Adjust "reset;" command to terminate all "commands" and "data" commands: "reset;" is an immediate command, executed when seen. Previously, it appeared to work when executed in single-step mode, but a commands-reading procedure was left running, and chaos could ensue when it terminated. 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: Fix memory fault in redeclaring objectives. 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: Quote symbolic subscripts in more error messages. Expand command: try to keep number*variable on the same line (so far just for linear terms). Fix bug in handling nonlinear defined variables under -L (option linelim 1) when they involve linear terms and appear linearly in constraints, objectives, or other defined variables. Example: var x; var y = x^2 - 2*x + 1; minimize zot: 2*x + 3*y; option linelim 1, nl_comments 1; write gf; # bogus v number for 3*y (in f.nl) Fixing this bug led to an improvement in the classification of nonlinear variables sometimes changes the resulting .nl file (and could slightly reduce the work some solvers do). It also revealed a long-standing bug in the AMPL/solver interface that caused wrong derivatives to be computed in problems that involve defined variables with right-hand sides of the form another_defined_variable + linear_expression Fix bug in printing a hitherto unused variable after a solve. Example: var x{1..2} >= 0; var y := 42; convex: x[1] + x[2] = 1; minimize zot: x[1] + 2*x[2]; solve; display y; #bogus value 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. 19950519: Fix horrid, long-standing bug with subscripted sets of arity > 1 (apparently introduced in version 19940128): when such sets had more than 32 members, tests of membership in them went awry. Example: set A; set B{A} dimen 2; set C dimen 2; set D := {i in A, (j,k) in C diff B[i]}; data; set A := a b; set B[a] := (x,x) (x,y); set B[b] := (y,x) (y,y); set C := (x,x) (w,x) (y,y) (y,z); display D; # correct let B['a'] := B['a'] union {1..4,1..8}; # now B['a'] has more than 32 members display D; # botched: (a,w,x) was erroneously in D 19950521: New variant of close command: close; closes all files opened by redirections. 19950524: Fix bug in presolve's handling of piecewise-linear terms that can be turned into linear terms because of deduced variable bounds: constraints (and defined variables) specifying a variable to be the sum of such terms where mishandled. Break out of compound commands when the solution, write, solve commands fail. 19950530: Fix bug (possible memory fault or at least botched error message) in the error message xxx does not work with variables for xxx = "match", "OPNUM2STR". Fix possible glitch in the expand commands printing of nonlinear expressions (a length value wasn't returned, which could cause some lines to be too long or too short). Fix memory fault with multiple occurrences of the same $env[something].val expression (under the right circumstances). Example: set A default {'a'}; environ E{A}; option E['a'].solver cplex; print {a in A}: $E[a].solver, $E[a].solver; # fault Fix bug in testing membership in Cartesian products (under the right conditions). Depending on the compiler, the test may have come out wrong. 19950608 Fix bug in "reset data;": storage for subscripted items whose actual index set has only a single member (e.g., which are given a single value in a data section), and for subscripted sets in general, went onto the wrong free-list, possibly causing unpredictable subsequent behavior. 19950614 Fix bugs in handling strings in the ord, next, and prev functions. Example: set A ordered := {'a', 'b', 'c'}; print ord('b',A); # fault print next('b',A); # fault 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.) Fix glitch in dropping nodes: if something forced a dropped node to be regenerated (because of its appearance in arc declarations), incorrect constraint names might sometimes appear, unpredictable behavior might occur because of a memory-overwrite error, and if the problem had defined variables, an infinite loop resulted (in, e.g., solve and write commands). Fix bug in handling set expressions in read commands: expressions within the set expressions were sometimes not computed, which could cause a memory fault or other untoward behavior. Example: param p default 2; param q{1..p}; read{i in 1..p} q[i]; # memory fault 1.1 2.2 display q; Warn of missing subscripts on sets. (Later we hope to warn about other missing subscripts, but that's harder.) 19950618 Fix glitch with "system sets" _PARS, _SETS, etc.: displaying two at once led to "unexpected subtype 16 in same_set". 19950620 Fix long-standing bug in handling if expressions in a nonlinear context when the test can be moved outside of a loop. Example: ampl: var x{1..2,1..2} >= 0;; ampl: minimize zot: sum{i in 1..2, j in 1..2} ampl? sin((if i == 2 then 10+j else j)*x[i,j]); ampl: solve; error processing objective zot: unexpected rewclass 4 for op 0x14e2 in ecopy 19950716 Fix bug in redeclarations of, e.g., indexed params with default expressions. Something got freed twice, causing unpredictable subsequent behavior. Increase by a factor of 256 the largest allowed single memory allocation. This increases the number of subscripts (members in indexing set) for an indexed param from 4194304 to 1073741824. Banish the message "More than 2000 columns; must increase CNMAX." In redeclarations that do not specify a := value, retain data where possible. Fix bug in deleting for and repeat loops: if the loops' controlling expressions involved constants (such as 0) or expressions involving only constants (such as atan(1)) that appeared in the model, subsequent attempts to solve the model could lead to unpredictable behavior. Fix bug (e.g., memory fault) in evaluating objective values and constraint bodies after an error interrupts a solve or write command. Fix memory-overwrite bug in initially dropping a constraint, changing something (e.g., a set or param) on which the constraint depends, then restoring and trying to use the constraint. (The change to the ungenerated constraint's prerequisites caused an erroneous attempt to save the constraint's dual variables before generating the constraint.) 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 Fix memory fault in "write;" (which is supposed to be the same as "write $outopt;"). Fix bug in simplifying constant expressions in a nonlinear context. Example: set S; set T; var x{T} >= 0; param p{S,T}; minimize zot: sum{i in S} exp(sum{j in T} p[i,j]*(p[i,j]+1)*x[j]); data; set S := a b; set T := d e; param p := [a,*] d 0 e -1 [b,*] d 3 e 4; # For i = 'a', exp(sum{j in T} p[i,j]*(p[i,j]+1)*x[j]) # vanishes; a bug caused a memory fault during simplification. 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 Fix bug (possible memory corruption) in handling solver messages over 120 characters long. Fix failure to complain about invalid subscripts in set A; set B{A}; data; set A := a b c; set B[a] := ab bc; set B[b] := ba bb; display B; let A := {}; display B; # didn't complain about bad B subscripts Fix bugs introduced in 19950315 in handling option commands with old-style concatenations as values. Examples: option solver $solver b; # should append b to $solver, # but gave syntax error option solver $solver 'b'; # same: but it looped. Fix bug in handling "reset data; data diet.dat; solution diet.sol;" before reading any data: the solution command appeared to be ignored. 19950727 Adjust show command to omit $display from the list of declared sets. Example: display{i in 1..5,j in 5..10} 10*i+j; show s; # erroneously mentioned $display 19950801 Fix glitches in -MD and -O introduced in the last changes (19950727). Do not break compound commands or command-line file processing when presolve determines the solution (e.g., eliminates or fixes all variables). Fix glitch in parsing if $solver == $$solver then (Workaround: put parens around the logical expression.) Fix possible memory fault associated with the match and sub functions. 19950802 Fix glitch with csvdisplay's display of 2-D tables with option display_1col 0, omit_zero_rows 1 /* small value */; Adjust "show" to reflect current drop/restore status after a problem command. 19950804 Fix bug in saving problem drop/restore (and fix/unfix) status: changes away from the status declared for the problem made the first time the problem is current were lost. Example: # First two problem declarations problem Sub: Artif_Reduced_Cost, Trans, Supply, Demand; problem Master: Artificial, Weight, Excess, Multi, Convex; # Master is current; change away from its declaration: drop Artificial; restore Total_Cost; fix Excess; # Do something with another problem problem Sub; drop Artif_Reduced_Cost; restore Reduced_Cost; # Switch problems: changes away from problem declaration # were lost. problem Master; show obj; show var; Inhibit executing commands in files other than stdin after the message "Abandoning compound command to accept ...". 19950808 Fix bug with -P (option presolve 0): if declared bounds caused a piecewise-linear term in a constraint to turn into a linear term, memory could be corrupted in an unpredictable way (leading to subsequent chaos). Fix glitch in show command: in the following example, the show command gave "(o.0 := avail)" rather than "avail" as the right- hand side. model steel.mod; data steel.dat; print total_profit, avail; show Time; 19950810 Fix bug in "expand": piecewise-linear terms after the first one printed had the wrong slope and breakpoint lists: they duplicated those of the first (in each constraint or objective). Allow the expand and solexpand commands to show dropped families of constraints. Previously, the sequence set A; s.t. foo{A}: /* ... */; drop foo; expand foo; resulted in no output; now it shows the foo constraints, adorned with the comment "# Dropped". Fix bug in solexpand's test for constraints eliminated by presolve. Adjust solexpand to say "# Presolve completely eliminated foo." in response to "solexpand foo;" when appropriate. Previously the solexpand command gave no output in this case. Add the comment "# Eliminated by presolve." when appropriate to solexpand output for a subscripted constraint. Thus solexpand foo[3]; might elicit this comment, whereas solexpand foo; might elicit the comment "# Presolve completely eliminated foo." Correct a possible memory fault with the show command (in complicated situations). Allow the print command to have no arguments, which causes it to behave the same as printf "\n"; 19950811 Fix bug in reading dual values for problems with free rows when -P (option presolve 0) is in effect. Presolve eliminates free rows (i.e., constraints of the form -Infinity <= stuff <= Infinity), but -P allows them to be conveyed to the solver. The bug could result in incorrect dual values for some constraints, and could cause memory overwrites and subsequent unpredictable behavior. 19950815 Fix possible memory fault in the cd command with WATCOM-compiled binaries. Fix botch in deleting subscripted set references in command contexts other than expressions appearing in an indexing expression (memory for which is not yet recovered). Subsequent commands referencing the subscripted set could give unpredictable behavior. Example: set A; set B{A}; data; set A := a b c; set B[a] := x; set B[b] := ; set B[c] := x; for{i in A} printf "'x' is%s in B[%s]\n", if 'x' in B[i] then '' else ' not', i; # deletion of ('x' in B[i]) was botched, giving different # results to a repeat of the same command: for{i in A} printf "'x' is%s in B[%s]\n", if 'x' in B[i] then '' else ' not', i; 19950827 Fix bug in handling in handling string-valued loop invariants, as in set A; param p{A} symbolic; set B; param q{B} symbolic; for{i in A, j in B} { if p[i] == q[j] then print i,j; } (in which p[i] is invariant as j ranges over B). If it bit, the bug could cause unpredictable behavior. Fix a bug that could give the error message "presolve vT bug". The bug sometimes bit after presolve deduced sharper bounds that turned a piecewise-linear term into a linear term. Fix a bug in handling complicated column-generation structures after, e.g., a data update followed by a printing command that caused some (but not all) entities necessary for "solve" to be updated. An ensuing solve sent the wrong problem to the solver. (The bug fix entails a significant change to the logic for deciding what needs to be recomputed.) Fix a memory fault in executing "expand undefined_name;". Fix a bug with renumbering defined variables after some change forces "earlier" variables to be regenerated (or generated for the first time). The bug could cause the message "solve_out bug" (or worse, could silently cause the wrong problem to be generated). Fix an infinite loop in deleting a sum that expanded into the sum of two variables. Fix glitch in displaying a variable indexed over an empty set when the variable has no := or default clause and is not given an (empty) initial value in a data section. Put parens around names generated for variables added to linearize piecewise-linear terms. Fix glitch in recomputing some set expressions in for loops. 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 Fix glitch that forced one to use .val notation when referring to the value of a variable in the set specification of a for loop. Fix bug with drop scalar_constraint; solve; restore scalar_constraint; expand; (where scalar_constraint is an unsubscripted constraint): the "expand;" did not show scalar_constraint. Fix bug that caused set A dimen 2 default {}; var x{1..3}; s.t. c{(i,j) in A}: sum{k in 1..3} i*x[k] >= j; display c; to give the error message "No values for c.". Now it says "c; #empty". Fix botch in handling slices of the same kind over different sets when the sets turn out to be the same (have the same members): because of erroneously freed memory, unpredictable behavior was possible. Fix redeclare bug revealed by: var x {0..10}; minimize obj: sum {j in 1..10} x[j]; subj to jump {j in 1..10}: x[j-1] = x[j] - 1; solve; redeclare subj to jump {j in 1..10}: x[j] = x[j-1] + 1; solve; #fault Fix a bug with arcs as defined variables: sometimes they gave rise to a constraint with an unutterable name, rather than a nonlinear defined variable. Now they act as other defined variables. Fix bug with "delete" and "purge" that could cause subsequent "show" commands to fault or print the wrong entity. 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). 19951010 Fix botch with "let" set assignments, revealed by set S ordered; let S := {"A","B","C","D"}; display {i in S} ord(i); # A had ord 4 rather than 1 19951015 Fix bug in computing .dual, .lb1, .lb2, .lbs, .ub1, .ub2, .lbs, .ubs notations for partially dropped constraints. 19951019 Fix buglet with "fix;" that caused it to show defined variables (as unfixed). Fix bug in handling indexed params (etc.) that have a default expression. If "let" or "read" or "update data" caused the param to have data for invalid subscripts, causing an error message about the data being discarded, and some subsequent command caused the default expression to be evaluated, chaos could ensue. Fix bug in handling problem declarations with indexing expressions: the indexing expressions were not necessarily reevaluated after "let" or "read" or "update data" should have affected them. Fix bug with "commands foo.dat;" when foo.dat consists of or ends with a data section that starts with "data;". 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 Fix bug with "show" after "delete": param p; param q; show par; delete p; show par; said "parameter: p". Fix bug in deleting objectives (with the delete or purge command): an expression got deleted twice, which could cause subsequent chaos. Fix memory allocation bug in discarding subscripted problems when the problem's indexing set shrinks. Fix another bug in handling problem declarations with indexing -- another context where the indexing expressions were not necessarily reevaluated after "let" or "read" or "update data" should have affected them. 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. 19951130 Fix precedence bug in printing nonlinear expressions involving sums: parentheses were omitted incorrectly. Example: var x; minimize zot: (x + 2)^2 + x*(x^2 + 3*x); expand; gave minimize zot: 2 + x^2 + x*x^2 + 3*x; Adjust error reporting for discarded subscripts so this "error" won't cause compound commands to be aborted, or "solve" to think that presolve found the problem infeasible. Fix bug in handling slices: chaos could sometimes ensue if, e.g., one tried to compute with a set for which no data had been given. 19951202 Fix bug in evaluating a dropped objective before anything else requires the collect phase. Example: var x; minimize zip: (x-1)^2; minimize zap: (x-2)^2; objective zap; print zip; Fix bug introduced 19951027 in the above example with "objective zap" changed to "drop zip". 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 Fix memory fault (or worse) with "delete" after "redeclare". Example: param p; redeclare set p; delete p; display p; # fault 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.) 19951219 Fix bug with deleting or redeclaring a variable, constraint, or objective or an entity declared before a variable, constraint, or objective. Fix memory fault with "update data" after deleting something, but not everything declared after it. Fix bug with redeclaring a param with a recursive := clause. 19960101 Fix a glitch in processing var = declarations in which the same variable appears linearly two or more times in the right-hand side. The glitch only affects a forthcoming extension to the AMPL/solver interface for recognizing partially separable structure and computing Hessians. 19960104 Fix bug in handling slices of sets declared with := when the right-hand side changes. Example: set A; param p{A}; set B := setof{i in A} (i,p[i]); data; param :A: p := 1 11 2 12 3 13; display {(i,12) in B}; reset data; data; param :A: p := 7 12 14 12; display {(i,12) in B}; # said ":= 14" instead of ":= 7 14" Fix bugs in "expand" and "solexpand" of a dropped objective or constraint. Example: param N := 5; var x{1..N} >= 0; fix12: x[1] + x[2] <= 0; convex: sum{i in 1..N} x[i] = 1; minimize zot: sum{i in 1..N} i*x[i]; blotch: sum{i in 1..N} x[i] + sum{i in 1..N} x[i] = 2; fix_x4: x[4] = .3; drop blotch; expand blotch; # memory fault solexpand blotch; 19960116 Fix bug in handling some file names of the form (i), as in for{i in S} commands (i); 19960125 Fix a bug that could cause the error message "invalid refct 0 in opgen" under conditions that seem hard to describe. 19960202 Adjust DOS .exe files to print nonzero return codes from solve and shell commands. Fix bug in handling a defined variable after some change causes a nontrivial linear, piecewise-linear, or nonlinear part to go away. Example: var x := 2; param t default 1; var y = t*(x + 1)^2; minimize zot: x^2 + y^2; print zot; # 85 let t := 0; print zot; # should be 4; was 85 again 19960207 Fix a bug revealed by an example with two objectives, each involving variables with the same literal subscripts, in a loop that alternated between objectives and forced them to be regenerated. A symptom of the bug was that a linear objective suddenly appeared nonlinear. Example: param p; var x{1..2, 1..2} >= 0; minimize zip: p*x[1,2] + 2*x[2,1]; maximize zap: p*x[1,2] + 3*x[2,1]; s.t. convex: x[1,2] + x[2,1] == 1; option solver cplex; for{i in 1..3} { let p := i; solve zip; solve zap; } Fix botch in handling named problems that could cause unpredictable results (under conditions hard to describe). 19960219 Fix bug (apparently introduced in version 19951019) in handling files that do not end with a newline: the last partial line was ignored, and, under -t, a memory fault was possible. [In the MS-DOS student binaries, this is fixed in version 19960219a.] Fix memory fault in var x <= 3; minimize zot: (x - 4)^2; let x := x.ub; # before something made presolve run 19960223 Fix a bug in handling several slices over the same set. The bug was revealed by a memory fault in a very complicated example. 19960227 Fix memory fault revealed in a "repeat" loop as the first command executed, such as param i default 0; repeat { display i; let i := i + 1; } while i < 3; Fix glitch in exiting "for" and "repeat" loops after an error: for example, on infeasible problems, the sequence "expand; solve;" caused enclosing loops to terminate after the "expand" without for loops being torn down properly; this could make dummy variables of the "for" loops still appear to be known. Example: var x >= 0; param p; maximize foo: x; s.t. zot: x <= p; let p := 4; repeat { for{k in 1..4} { let p := p - 1; display p,k; expand; solve; display x; } } while p > -3; Fix bugs in, e.g., "display _svar, _svar.ub, _svarname;" and in evaluating _svarname[i]. 19960306 Allow printf's "+" flag to reveal the sign of 0. Fix glitch (e.g., memory fault) with redeclaring variables, constraints, or objectives when a subsequent "solve", or "solution" command occurs before anything else forces the problem to be reinstantiated (as the redeclaration should have been doing). Fix bug with "option presolve 0" when bounds turn piecewise-linear terms into linear terms. 19960313 Fix bug in handling index sets common to several entities when some change (e.g., a let command) caused some of the entities to be recomputed. It was possible for the common index set to be deleted prematurely, leading to subsequent chaos. Arrange for redeclarations of variables, constraints, and objectives to retain current values and drop/fix status. Fix bug introduced 19960223 in handling multiple occurrences of the same slice of a subscripted set. 19960330 Fix glitch (possible memory fault, or wrong subscripts in error messages) with dummy variables instantiated in linear sums appearing in objectives and constraints. Fix glitch in evaluating logical expressions: in (A and B) with A false or (A1 or B) with A1 true, if B appeared several times, it might be evaluated, possibly leading to an error message. Example: set I := 1..2; param p{i in I, j in I: j >= i} := i + j; set S := {i in I, j in I: j >= i && p[i,j] > 1 && p[i,j] < 3}; var x{S}; minimize zot: sum{(i,j) in S} (x[i,j] - p[i,j])^2; solve; # "invalid subscript p[2,1]" 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)]; 19960403 Fix glitches introduced 19960401 during "improvements" in set generation. For example, sets with "such-that" conditions that do not depend on anything in the set were effectively ignored. Example: display sum {i in 1..2: 0 == 1} i; should print 0 (but printed 3 with the bug). 19960411 Banish "adjoin: SBUFLEN is too small" message arising from reading a large "param foo := ..." table in a data section. Fix bug in handling updates to sets that turn out to be the same. Example: set A; set B; let A := {'abc'}; let B := A; for{i in 1..2} { let A := A union {i}; let B := B union {i+10}; } display A, B; # said no data for set A # listed B twice with the "for" changed to "for{i in 1..1}" Fix memory fault with nested "for" commands in which an inner "for" has a "such that" clause that causes the inner "for"'s body not to be executed on the last iteration of the outer "for". Example: param p; for{i in 1..3} { let p := 10 + i; for{j in 11..13: j > p} print i,j; } 19960417 Fix bug (memory fault) in handling constant subscripts in problem declarations. Fix bug in recording partial drop statuses in certain circumstances; the bug could cause the erroneous conclusion that all members of an indexed collection of variables were dropped. Example: var x{1..4} >= 0; var y{1..4} >= 0; minimize foo{i in 1..2}: sum{j in 2*i-1..2*i} j*x[j]; minimize goo{i in 1..2}: sum{j in 2*i-1..2*i} j*y[j]; s.t. zip{i in 1..2}: sum{j in 2*i-1..2*i} x[j] = 1; s.t. zap{i in 1..2}: sum{j in 2*i-1..2*i} y[j] = 1; problem p{i in 1..2}: x[2*i-1], x[2*i], foo[i], zip[i]; problem q{i in 1..2}: y[2*i-1], y[2*i], goo[i], zap[i]; solve p[1]; solve q[1]; # erroneously said "all variables fixed" Following Fortran 90, add "/=" as a synonym for "!=". 19960418 Fix bug introduced 19960331 with read commands with "<" redirections. Terminate includes within the file in a read command's "<" redirection when the read command ends. 19960425 Fix buglet with the builtin "num" function: it complained at trailing white space rather than ignoring it. Fix bug (possible memory fault) with displaying strings involving '$' followed by a numeral. Example: display 'ab$123'; # memory fault Fix bug printing an error message for a symbolic parameter that fails an assertion (such as an "in" clause) in its declaration (after being assigned a value by the "read"command). Example: set S := {'A', 'BCD'}; param p symbolic in S; read p; E display p; # fault Fix bug (memory fault, or worse) with "purge" and "delete" commands applied to problems. Fix erroneous message about circular dependencies in redeclarations of arcs. Fix memory fault with certain sequences of redeclarations and expression evaluations involving variables fixed by presolve. Example: var x; s.t. f: x = 0; display x.lb0; redeclare var x >= 0; display x.lb0; # fault Adjust xref command so it does not show nodes cited in arc declarations. Make it possible to delete and purge arcs. Fix bug (e.g., memory fault) freeing "continue" commands after execution of compound commands containing them. 19960510 Fix bug with the display command's handling of unsubscripted _con references: chaos could sometimes ensue if there were more constraints than variables (with numbers on different sides of a power of 2). 19960516 Fix bug with "reset data foo;" when foo is not declared with an indexing set. Unpredictable results were possible. Fix bug displaying symbolic parameters that look like numbers. Example: param p symbolic := '1D23'; display p; # said p = '1e23' 19960516 Fix bug with "reset data foo;" when foo is not declared with an indexing set. Unpredictable results were possible. Fix bug displaying symbolic parameters that look like numbers. Example: param p symbolic := '1D23'; display p; # said p = '1e23' 19960606 Fix glitch with "cd" command, which could fail if it involved a param that had not been evaluated previously. Adjust option debug_stub to honor (and retain) ($solver)_auxfiles. Fix bug in handling loops containing data commands: more than a dozen or so iterations elicited an erroneous message about includes being nested too deeply. Example: model diet.mod; for{1..20}{update data; data diet.dat;} Fix bug in handling nonconvex (resp. nonconcave) piecewise-linear terms: when the problem had "unused" variables, either because some indexed variable had an indexing set larger than the set of indices used in the problem, or because some previous command forced another variable to be instantiated that did not appear in the current problem and was declared before one of the problem's variables, the resulting ".nl" file had an incorrect first line. Example: var x{i in 0..2} >= -20; # x[0] is "unused" convex: x[1] + x[2] == 1; minimize z: <<-1,1,4; -1,1,-1,1>> x[1] + <<4;-1,1>>x[2]; Fix some single-stepping glitches, e.g., in handling a command entered in single-step mode that fails for want of data. Fix nasty but seldom-seen bug in computing the right-hand side of a set-valued "let" command and the indexing set of a "for" loop (but not other indexing sets): if the set was represented by a memory previously used for an indexing expression whose scope involved common expressions that changed with the set members, the set was treated as empty. Fix some memory leaks (in scripts that execute many commands). Fix glitch with "continue foo;" in a "for" loop within loop foo: dummy variables of the inner "for" were not restored properly, which could cause subsequent parsing errors in declarations or commands involving the dummy names. 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 19960609 Fix bug in computing recursively defined params when several independent recursions are needed. Example: set A circular := 1..146; set B circular by A ; param c { d in A } in B := if d in B then d else c[next(d)] ; data; set B := 1 4 21 26 36 39 44 57 60 68 71 94 97 101 134 137 142 146; display c; #fault Diagnose (illegal) circular recursive set definitions (rather than looping until memory is exhausted). 19960615 Fix bug in handling "repeat" commands with a "while" or "until". Under complicated conditions, a fault was possible. Fix glitch with "expand" and "problem": an "expand" command executed as the first command after various declarations, including problem declarations, sometimes resulted in a surprising error message ("unexpected type ... in collect_setup()"). Fix bug in the interaction of named problems and drop/restore, fix/unfix: trouble was possible if explicit "drop" or "fix" commands eliminated all members or "restore" or "unfix" commands brought them all back into the problem. Fix bug (memory fault) with the sequence s.t. foo{...}: ...; #new constraint declaration display foo; solve; # memory fault after the solver message is echoed. Fix bug, probably introduced in version 19960330, in handling the logical expressions not (a == b) and not (a != b) when a or b was symbolic (e.g., a symbolic param). Fix glitches with option single_step: there was no break at the first command of a compound command, and using control-D (Unix) or control-Z (MS-DOS) to single step the last command of a compound command resulted in EOF. 19960627 Fix bug simplifying piecewise-linear expressions: example: var x; minimize foo: <<1;-1,1>> x + <<2;3,4>> x; was turned into <<1, 0; 2, 4, 5>>x rather than into <<1, 2; 2, 4, 5>x, but var x; minimize foo: <<2;3,4>> x + <<1;-1,1>> x; was handled correctly: there was a glitch in one of the end cases. Fix glitch with cd command in Symantec DOS AMPL.EXE: explicit letters were interpreted off by one. 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. 19960707 Fix glitch with var = declarations with "constant" right-hand sides (not involving any variables, i.e., declarations that should have said "param" rather than "var"): in some cases, such variables did not appear to have been initialized with the right-hand side value. Example: var x = 3; var y = 4; display x; # correct: x = 3 display y; # wrong: y = 0 Fix bug in updating slices over sets declared without := or default. Example: set A; set B dimen 2; param p{i in A, (i,j) in B} := i + j; display B; # provokes error message: no data for B set C; data; set C := a b c; set A := 1 2 3, 10, 20, 30, 40, 50; set B := (1,10), (1,20), (2,30), (3,40), (3,50); display p; # fault Quietly omit defined variables from problem declarations. (This repairs a memory fault previously associated with such declarations.) 19960709 Prevent execution of problem commands from running presolve (and thus possibly giving an erroneous message about inconsistent constraints). 19960718 Fix bug with "option nl_permute 0" and "option nl_permute 1": wrong information on Jacobian nonzeros sometimes went into the .nl file. Fix bug in reading .sol files corresponding to option nl_permute at nondefault values. 19960729 Fix glitch in reading data sections having sets of arity > 10. Disallow writing MPS files for problems with nonlinear variables. Fix glitch in reading g-format .sol files written with \r\n at the ends of lines. 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). 19960731 Fix bug in numbering variables when an error (such as "no value" for a param) interrupts problem instantiation. Symptom: wrong variable names in "expand" command. The bug bit under complicated conditions. 19960816 Fix glitch in the numbers of nonlinear and linear variables reported by option show_stats when option nl_permute has the nondefault values 0 or 1. Fix faults under complicated conditions (a) after discarding invalid subscripts and (b) with missing data. Fix bug in the expand command applied to a constraint or objective declared with "{if test}" when "test" turns out false, as in param a := 1; var x; s.t. c{if a > 2}: x >= 1; Fix infinite loop in processing the erroneous input var x; s.t. con2: {if 1 > 2} x >= 1; # syntax error (misplaced : ) expand con2; Fix bug in naming constraints and objectives when an {if false} constructs appear. Example: var x; s.t. c {if 1 > 2}: x >= 1; expand c; s.t. con2 {if 1 <= 2}: x >= 1.5; expand con2; # con2 >= 1.5; Fix bug (fault) in "delete" applied to a pipe function. 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 19960819 Fix glitch in handling "default nnn" in a data section when not followed by ":=" and when applied to a param indexed by a set of arity > 1. Example: set A dimen 2; param p{A}; data; set A := a b c d e f; param p default 3 [c,d] 4; # default phrase appeared display{(i,j) in A} p[i,j]; # to be ignored. 19960822 Fix a glitch that sometimes caused a "bad binary file" message from the "solve" and "solution" commands on the DEC Alpha. The glitch was in handling 64-bit "long" integer variables and had no effect on most (32-bit) machines. 19960825 Fix a bug in handling common set expressions whose first uses involve membership tests and whose later uses involve iteration over the set expressions, as in set A; set B; ... s.t. c1{i in C}: ... if (i in A union B) then ...; s.t. c2: ... sum{i in A union B} ...; solve; # Change something that will force c1 and c2 to be regenerated solve; # possible fault or worse 19960826 Fix botch in error message given when a data section provides a subscript for a set that is declared not to be subscripted. The botch could cause a fault or a strange name in the error message. Example: set A; data; set A[1] := a b c; 19960829 Add "inout" and "out" to the reserved-word list (for use in upcoming extensions). 19960922 Fix glitch with option log_file under block mode: some input didn't get copied to the log file. Fix performance bug (which slowed execution and burned memory, but did not affect correctness of results) in handling slices of subscripted sets. Terminate all (not just some) commands in which genmod detects errors. 19961003 Fix bug (leading to a memory fault during execution) in parsing superfluous braces within a compound command, such as those around the display command in for{i in 1..2}{ if i < 2 then print 'yes'; {display i;}} 19961016 Fix glitch (loop) in recovering from a syntax error in a list of commands gratuitously enclosed in braces. Fix bug that bit (e.g., with a fault) under complicated conditions with recursive params (including those with a recursive "check" condition) that have a default expression. Fix bug with option linelim: in a model with defined variables, the sequence option linelim 1; solve; /* adjust something, then... */ option linelim 0; solve; display _var; could lead to a fault (or worse). 19961017 Fix fault with defined variables in certain sequences of commands, such as display a_defined_variable; problem another_problem; let variable := ...; 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 19961023 Fix bugs with ord(i), next(i), prev(i) and their relatives when i is a dummy in a for loop. 19961100 Fix some bugs in handling subscripted environments and problems: faults were possible under the right complicated conditions. Example: environ E{1..3}; set I := 1..2; var x{i in I} >= 0; minimize zot: sum{i in I} i*x[i]; s.t. convex: sum{i in I} x[i] = 1; problem foo{i in 1..3} environ E[i]: x, zot, convex; problem foo[1]; # fault Fix bug in "show e;" (to show environment names) after a "reset;" following environment declarations (including the implicit ones associated with problem declarations). 19961109 Fix bug with defined variables: under certain conditions, a scalar or subscripted defined variable evaluated as 0 rather than its correctly computed value. (The situation in which this happened could be seen with "option times 1;": the bug bit when collect ran without a subsequent presolve before the defined-variable evaluation.) 19961112 Fix glitch with "redeclare": it faulted when applied to a declaration for a name that had not been declared (or had been deleted). 19961130 Fix glitch with recursive set declarations: in situations where the same expression appears twice or more, it was sometimes evaluated when not needed, possibly giving rise to an erroneous error message about an invalid subscript, as in the following example: param p{i in 2..4} := i; set S{i in 1..4} := if i == 1 then {} else if p[i] == 2 then {1} else if p[i] == 3 then 2..3 else 1..4; display S[1]; # error message about evaluating p[1] Fix fault with evaluating certain nonlinear "if" expressions in which the condition does not involve variables and can be evaluated in an outer context. The show command's printing of recursive parameter definitions will now say ":= /*recpd.*/(...)" or ":= /*srecpd.*/(...)" rather than ":= recpd.(...)" or ":= srecpd.(...)". 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. 19970104 Fix another bug in recursive set definitions involving literal sets (such as {1}), setof expressions and iterated unions. Unpredictable results were possible. 19970212 Fix rarely seen bug (resulting in a memory fault) that arises under complicated conditions. 19970219 Fix (rarely seen) bug that could cause a fatal "solve_out bug!" message. Work-around: "option presolve 1;". Fix failure to diagnose nonnumeric values in the following context: param p{1..2}; data; param p := 1 abc 2 xyz; display p; # bogus values for p Fix bug (memory fault) in deleting defined variables. In data sections, recognize as numeric values Infinity, -Infinity, +Infinity and, on IEEE-arithmetic systems, NaN, -Nan, +NaN. Code around WATCOM bug in comparing NaNs: the bug caused the display command to turn NaNs into zeros. 19970307 Complain at the appearance of problem names in the itemlist of a problem declaration. Tweak "show problem_name;" to print the itemlist in the declared order (rather than its reverse). 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 Fix bug in evaluating expressions involving problem-dependent synonyms (such as _nvars and _snvars): sometimes, e.g., when they appeared in printing commands after a problem command had changed the current problem (and before anything else caused the new problem to be instantiated), they were not recomputed. Fix memory leak with nonlinear expressions (in constraints and objectives). 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. 19970402 In the (weird) context set I := 1..2; var x{I}; for{i in I} if i >= 2 then print i,3; minimize zot: sum{i in I} i*x[i]; before processing the "minimize zot" declaration, recognize that there is no "else" command to match the "if" command. When a program (e.g., solver) cannot be invoked (under Unix), say why. Adjust generation of file names with option debug_stub to avoid confusion when all variables are fixed by presolve. Fix glitch (possible fault) introduced 19970212 affecting string functions ctime, gsub, sprintf, sub, substr. 19970408 Fix glitch in handling redirections in the "read" command: entities in them were not instantiated by the read command. Example: param dummy; param fname symbolic := "seq.dat"; read dummy < (fname); # error message: fname not instantiated display dummy; Adjust the handling of the default-value symbol in data sections so it is only recognized when given with the same kind of quotes (none, " or ') with which it is declared. (The initial default-value symbol continues to be . with no quotes.) Thus, for example, param p symbolic; data; param p := "."; display p; will now show that p has the value "." rather than no value. 19970413 Under MSDOS (and MSWIN), quietly ignore command-line options -v2 and -ve (which are always in effect). Fix bug in handling "if" expressions in some contexts when the "if" test can be done at a more outer loop level than the "then" or "else" expressions. Example: param j := 1; set T := 1..10; param x{T}; let{t in T} x[t] := max(0, if j == 0 then t else 0.5*t); display x; # all x components had the x[1]'s value (0.5). 19970417 Fix bug that could give "tva top error" message when evaluating complicated recursive parameters or sets (when first evaluated in certain contexts, such as a printing command). Example: param M default 5; set I := 0 .. M; set A := {i in I, j in I, k in 0..1: (i < M || k == 1) && (j < M || k == 0)}; param N{(i,j,k) in A} := if max(i,j,k) == 0 then 1 else 1 + (if k == 1 then (if i < M then N[i,j,0] else N[M-1,j,1]) else if i > 0 then (if j == M then N[i-1,M,0] else N[i-1,j,1]) else N[M,j-1,1]); display N; Workaround: declare something that forces the recursive entity to be evaluated. For example, ch