Mon Apr 21 22:35:13 EDT 1997 Extensive revisions to the entire ampl/solvers tree, corresponding to an updated "Hooking Your Solver to AMPL": ftp://netlib.bell-labs.com/ampl/REFS/hooking.ps.gz Tue Apr 22 07:56:07 EDT 1997 pfg_read.c pfghread.c: fix glitch that could cause a fault (during setup for Hessian computations). Thu Apr 24 12:46:31 EDT 1997 misc.c: fix a glitch in reading suffix tables (a forthcoming AMPL extension). Sun May 18 13:40:12 EDT 1997 Tweaks: use a replaceable "getenv"; augment r_opn.hd (for a forthcoming driver); add rule for stderr.obj to makefile.*. Thu May 29 23:20:52 EDT 1997 Fix bug with xknown() with problems involving defined variables: derivatives were sometimes miscomputed. Wed Jun 4 11:44:14 EDT 1997 Adjust struct psb_elem in psinfo.h (currently just for use in lancelot/lancelot.c). Recompile amplsolver.a (or amplsolv.lib) from scratch, even if you get just the updated files (asldate.c, pfg_read.c, psinfo.h, xsum0.out). Add file README.f77 with changes that permit using the native Fortran 77 compiler on some systems. Tue Jun 17 22:29:37 EDT 1997 Fix a fault that was possible in the .nl readers when the .nl file was written with presolve turned off. Thu Jun 26 23:52:36 EDT 1997 Adjust Malloc and M1alloc so Malloc(0) and M1alloc(0) return nonzero values even if malloc is buggy in that malloc(0) returns 0. Wed Jul 9 14:55:48 EDT 1997 Adjust Realloc so Realloc(0,n) works analogously to Malloc(0). New field n_eqn gives (in struct Edaginfo) gives the number of equality constraints (if known from versions of ampl >= 19970627), or -1. This change requires recompiling all of amplsolver.a and any solver objects that #include "asl.h". Tweak to reading numbers of complementarity constraints in .nl headers (to be further documented later). getstub.c: fix glitch that sometimes caused -? to say "...[options] [options]..." rather than "...[options]...". obj_prec.c: adjust to use getenv_ASL. Mon Jul 21 12:33:08 EDT 1997 funcaddk.c: add missing line (AmplExports *ae = al->AE;) to function mean. Tue Jul 22 16:53:59 EDT 1997 func_add.c: ignore argtype = 6. Thu Aug 14 00:34:10 EDT 1997 Adjust getstub.c and getstub.h to permit specifying that underscores should be retained (rather than turned into blanks) in names passed to a Solver_KW_func. An enum now names bits in the "flags" field, with ASL_OI_want_funcadd (== 1) meaning that funcadd should be called, and ASL_OI_keep_underscores (== 2) meaning that underscores should be kept. Tue Aug 19 15:39:22 EDT 1997 pfg_read.c (and pfghread.c): fix bugs with linear defined variables referenced by other linear defined variables. Example: set I := 1..4; var x{I} >= 0 := .25; convex: sum{i in I} x[i] = 1; var y = x[1]; var d = 1 + y; s.t. zot{j in 1..2}: x[j] + d >= .1; minimize foo: sin(x[1]); led to an infinite loop. A more complicated example led to an assertion failure. (Henceforth, compile pfghread.c and pfg_read.c with -DDEBUG if you want the assertions checked.) Wed Aug 20 16:11:24 EDT 1997 Once again, pfg_read.c (and pfghread.c): fix another bug with linear defined variables that involve other linear defined variables, this time when constant terms are involved. The constant terms sometimes got lost. Example: set I := 1..3; var x{i in I} >= 0 := i; var y = x[1]; var z = y + 1; s.t. bletch: sum{i in I} x[i] + y + z == 2; s.t. zap: sum{i in 1..2} x[i] + z == 2; Fri Sep 12 01:09:37 EDT 1997 funcadd.c: for hypot(0,0), set the Hessian to all zeros. mip_pri.c: change "AMPl" to "AMPL". pfg_read.c (and pfghread.c): 1. Fix glitch affecting Hessian computations when imported (user-defined) functions involve some constant arguments. 2. Fix more bugs in handling defined variables. Example: var x0 >= 0 := 1; var x1 >= 0 := 3; var v2 = x1 - 2; var v3 = v2 * x0 + 10.4; # the constant term 10.4 s.t. c: v3 = 0; # caused trouble 3. Fix bug in allocation of al->hes for imported functions: constant arguments were not counted. sphes.c: fix glitch in computing sparsity of Hessians when imported functions are involved. Fri Sep 12 18:51:41 EDT 1997 pfg_read.c (and pfghread.c): fix two glitches that caused faults with certain models. Fri Oct 10 17:13:14 EDT 1997 stdio1.h0: protect #define Char with #ifndef Char . asl.h, jac0dim.c: change neqn to n_eqn (new field giving the number of equations), to reduce the chance of name classes (such as occurred in fsqp/fsqp.c). The comments above for 19970709 have been adjusted. Sat Oct 11 16:32:51 EDT 1997 Add to README another pointer to makefile comments; update xsum0.out (missed yesterday). Thu Oct 16 13:47:06 EDT 1997 con1ival.c, con2ival.c: fix bug with congrd(n, i, x, g, nerror) (Fortran 77 notation): if called with nerror < 0 at an (i,x) pair at which conival was not called, no gradient was computed. Thu Oct 23 20:09:51 EDT 1997 pfg_read.c pfghread.c: fix bug that could cause a fault on some machines (e.g., HP). Mon Nov 3 23:45:32 EST 1997 f_read.c fg_read.c fgh_read.c pfg_read.c pfghread.c: fix bug in reading cvar array for complementarity constraints (to be further documented later). Fri Nov 7 03:41:23 EST 1997 Add variants of xknown() with apparent signatures void xknowne(real *X, fint *nerror); void xknowe_(real *X, fint *nerror); that treat errors in evaluating common expressions the same way as other routines (objval, conval, etc.) that have a final nerror argument. Fri Nov 7 09:20:15 EST 1997 mip_pri.c nqpcheck.c: for simplicitly, back off changes early this AM that made some arrays available to either free() or M1record(). Arrays returned by these routines are freed automatically by ASL_free(&asl). Tue Nov 11 16:25:21 EST 1997 misc.c: fix botch introduced 19971107: s/xknowe(/xknowne(/ asl.h misc.c: change M1record to a Char** function, permitting one to Realloc or free the recorded memory block if one updates or zeros *(the return value from M1record) accordingly. Tue Dec 2 23:50:40 EST 1997 README.f77: point out need to remove -lf2c (references to libf2c.a) when using native Fortran compilers. Tue Jan 13 22:45:01 EST 1998 nqpcheck.c: if called with NULL for any of rowqp, colqp, or delsqp, omit changes that require adding quadratic-term contributions to the return values of objval, conval, and conival (as is done by function qterm in examples/qtest.c). Wed Jan 14 08:49:00 EST 1998 jac0dim.c: tweak (to treatment of Arith_Kind_ASL) foreshadowing forthcoming changes. Wed Feb 4 13:25:05 EST 1998 jac0dim.c: adjust jacdim variants to assume stub is null-terminated if stub_len <= 0. (This slightly simplifies invocations of these routines, as it removes the need for a strlen call, and though choosing file names with blanks in them is a very bad idea, this change permits blanks in the "stub".) Wed Feb 11 15:10:54 EST 1998 .nl file readers: fix a fault that was possible with certain nonlinear .nl files generated with "option presolve 0". Wed Mar 25 23:26:13 EST 1998 con1ival.c, con2ival.c: fix bug in handling nerror when a gradient is requested at a point different from the one where the constraint was most recently evaluated. The bug caused wrong gradients to be returned (the input G was unchanged). misc.c: fix glitch in Realloc's checking for a null return. Many routines: minor updates; new facilities for receiving and transmitting user-defined suffixes (to be described later). On most systems, nonlinear solvers should no longer link with funcadd0.o, but rather should link automatically with funcadd1.o, which is now in amplsolver.a. Exceptions: under MSDOS and AIX earlier than AIX 4.2, nonlinear solvers should still link with funcadd0.o (or otherwise, as indicated in the funclink subdirectory). Thu Mar 26 18:03:37 EST 1998 New file funcaddr.c, for compiling funcadd1.c so as to release amplfunc.dll when ASL_free() is called, rather than at the end of execution. This is for use with shared libraries that may be loaded and unloaded repeatedly during a single program execution, such as MATLAB mex files. Use of funcaddr.c is now illustrated in the rules for amplfunc.mex and spamfunc.mex in examples/makefile. Fri Mar 27 14:40:16 EST 1998 getstub.c: minor tweak for what now should be an unusual case: statically linking a funcadd.o with the solver. Mon Mar 30 16:43:25 EST 1998 asl.h: make solve_result_num a synonym for asl->i.solve_code_, the value that appears in AMPL sessions as solve_result_num. Thu Apr 2 17:36:57 EST 1998 func_add.c: if -ix is not given, assume -i$AMPLFUNC . Mon Apr 6 16:09:37 EDT 1998 qp_read.c: fix bug in qp_opify()'s handling of min(...) and max(...) expressions. Fri Apr 10 23:16:08 EDT 1998 makefile: add funcaddr.c to xsum.out. Fri May 8 11:33:00 EDT 1998 funcadd1.c: permit compiling with (e.g.) -DFUNCADD="funcadd_ASL_" to change the name sought in amplfunc.dll from "funcadd_ASL" to "funcadd_ASL_". Unless compiled with -DNO_DLOPEN_ERROR_MESSAGE, print a warning (on Stderr) when -i or $AMPLFUNC is specified and the library does not exist or cannot be loaded. On systems that provide a dlerror() function that returns a string explaining what went wrong, print that string. (Compile with -DNO_DLERROR if dlerror() is buggy, as it is, e.g., in at least one older version of Linux). makefile.wat: compile funcadd1.c with -DFUNCADD="funcadd_ASL_" . If you use non-default calling conventions, you may have to adjust this detail. Tue May 12 19:00:35 EDT 1998 dtoa.c: fix a glitch introduced with the scaling of 19970212 that caused one-bit rounding errors in certain denormal numbers, such as 8.44291197326099e-309, which was read as 8.442911973260987e-309. funcadd1.c: tweak to prevent undesired complaint of missing amplfunc.dll with -DWIN32. arithchk.c and makefiles: determine whether long long is available. Fri May 15 16:46:18 EDT 1998 dtoa.c: tweak to round 2.2250738585072012e-308 correctly. f_read.c fg_read.c: tweak so f_read does not pull in r_ops_ASL. Tue May 26 13:16:50 EDT 1998 objconst.c: correct glitch in use with pfg_read and pfgh_read. Note that objconst(n) returns 0 if objective n is not affine. Wed May 27 16:48:25 EDT 1998 objconst.c: add a missing #undef f_OPNUM; asldate.c not changed. Thu Jun 18 01:13:10 EDT 1998 Fix possible fault in, e.g., sphes(), with certain uses of defined variables. The fix involves a data structure change, so it is best to recompile all of amplsolver.a and any objects that include the solver interface header files. Adjust xectim.c to use getrusage() on Unix systems (for CPU time resolution of 1 microsecond). Fri Jun 19 18:52:08 EDT 1998 Fix typo in comments in funcadd.h (about where to store partials). arithchk.c: add logic for detecting IEEE-like arithmetic that flushes underflows to 0 (a bad thing). Wed Jun 24 16:33:55 EDT 1998 funcadd.h: type of Errmsg changed from Char to char. rops.c, rops2.c: explicitly check for sqrt(negative number) rather than relying on errno being set to indicate this. There exists at least one systems where this matters. Fri Jun 26 08:55:38 EDT 1998 funcadd1.c: minor tweak for compilation under SunOS 4.1x; asldate.c not changed. Tue Jul 14 14:43:13 EDT 1998 pfg_read.c pfghread.c: discard linear terms that end up with a coefficient of 0. This is mostly invisible, but can avoid a division by 0 (in pfg_read or pfgh_read) in certain complicated examples. Thu Aug 27 07:51:38 EDT 1998 conpval.c pfg_read.c pfghread.c: fix bug in handling two or more constraints (or objectives) involving a sum of monadic functions of the same linear combinations of variables. This only affected problems read with pfg_read() and pfgh_read(). Example: var x; s.t. zap{i in 1..2}: sqrt((x - i)^2 + 1) >= 0; (In this example, zap[2] was miscomputed.) Also, fix faults in some contexts in handling "constant" arguments of the form (e.g.) x-x for some variable x. Mon Aug 31 17:52:08 EDT 1998 pfg_read.c pfghread.c: "invisible" tweak to eliminate complaints of "cast to pointer from integer of different size" on some machines. Thu Sep 3 09:27:57 EDT 1998 Add comments about -DNANCHECK and -DNO_ERRNO to README. Wed Oct 14 00:30:21 EDT 1998 getstub.[ch]: new bit ASL_OI_never_echo for Option_Info.option_echo suppresses echoing of options (should it be desirable to scan them twice). New bits ASL_find_c_class, ASL_find_o_class, and their union ASL_find_co_class in the flags argument to pfg_read() and pfgh_read() instructs them to compute four new fields of ((ASL_pfg*)asl)->I and ((ASL_pfgh*)asl)->I classifying objectives and constraints as constant (0), linear (1), quadratic (2), or general nonlinear 3 (fields c_class and o_class) and giving the maximum values of these arrays (max_c_class and max_o_class). New field nlvog of struct Edaginfo; objgrd(np,x,g,ne) sets g[i] = 0 if the objective does not depend on x[i] and i < nlvog (or i < max(c_vars, o_vars) if nlvog is left at 0); nlvog must be set before the .nl reader is called. This matters to minos and snopt, whose drivers have been updated to specify asl->i.nlvog = nlvo. Fri Oct 30 01:50:47 EST 1998 Fix botch in handling first derivatives of user-defined functions having some numeric constant arguments and some arguments involving variables: if the total number of numerical arguments was more than 8, unpredictable behavior was possible. Fix bug in dtoa.c's handling of non-IEEE arithmetic machines, such as SGI machines executing -n32 and -64 (but not -o32) binaries, that flush underflows to zero instead of underflowing gradually. Fri Nov 6 14:49:37 EST 1998 dtoa.c: tweak to remove LL suffixes from numeric constants (for compilers that offer a 64-bit long long type but do not recognize the LL constants prescribed by C9x, the proposed update to the ANSI/ISO C standard). Thanks to Earl Chew for pointing out the existence of such compilers. This change should be invisible on most systems. Thu Nov 19 10:41:10 EST 1998 xectim.c: adjust so compilation with -DNO_RUSAGE will use CLK_TCK if available (on Unix systems, in limits.h). Tue Nov 24 23:32:33 EST 1998 names.c: fix glitch in obj_name(): when no .row file was present, obj_name(n) overwrote con_name(n). Wed Dec 9 10:11:12 EST 1998 README.SGI added describing how to restore IEEE arithmetic under SGI's -n32 and -64 compilation modes. Tue Dec 15 19:29:17 EST 1998 conpval.c: with readers pfg_read and pfgh_read, objgrd(nprob,x,g,ne) was treated as objgrd(0,x,g,ne). conpval.c, obj2val.c, objval.c: calls on objgrd(nprob,x,g,ne) for several nprob values and the same x might have given wrong gradients after the first call for that x. pshvprod.c: fix rarely seen bug in Hessian computations involving defined variables; a couple of operators that should have been += were simply = in defined variables whose value was the product of two or more variables, at most one of which was fixed by presolve. Example: var w := 3; var x = 1; var y = w*x; var z = w*y; minimize zot: z; # w^2 sphes.c: fix possible fault when sphsetup() is called a second time. Wed Jan 13 11:32:45 EST 1999 README: add new final paragraph about make invocations. Update xsum0.out (missed copying this file on 19981215). Tue Jan 19 01:08:35 EST 1999 New source file suf_sos.c helps use SOS suffixes (to be documented). Changes to asl.h (and several other source files) require all of amplsolver.a (or amplsolv.lib) to be recompiled. Tue Jan 19 11:28:11 EST 1999 suf_sos.c: add missing #ifdef KR_header stuff; asldate.c not changed. Mon Feb 1 17:50:46 EST 1999 suf_sos.c: fix botch in adjusting incoming integer-valued suffixes. amplsolv.lbc, amplsolv.sy: add suf_sos.obj. Sat Feb 6 17:55:09 EST 1999 asl.h: SufDesc: union u changed to struct u to facilitate debugging; amplsolver.a must be recompiled. suf_sos.c: enhanced to process suffixes .sosno and .ref (which can be set explicitly with let commands) as well as the .sos and .sosref suffixes supplied implicitly by AMPL (e.g., when it linearizes piecewise-linear terms). Each distinct nonzero .sosno value designates an SOS set, of type 1 for positive .sosno values and of type 2 for negative values. The .ref suffix contains corresponding reference values. Solvers calling suf_sos() must now declare all of the above mentioned suffixes. See, e.g., suftab and the suf_sos() invocation in solvers/cplex/cplex.c. Fri Feb 12 16:53:49 EST 1999 misc.c: zero SufDesc field u.i in suf_declare (required by changes of 19990206). writesol.c: under "g" (ASCII) format, cope with empty lines in the solution message. (Sensible solver drivers do not have such lines.) Fri Mar 19 08:42:14 EST 1999 asl.h: comments about ASL_reader_flag_bits added. suf_sos.c: trivial change; asldate.c not updated. Fri Apr 9 00:44:19 EDT 1999 pfg_read.c pfghread.c: fix a bug (fault or worse) that bit under complicated conditions. readsol.c: fix a bug in handling some incomplete .sol files. funcadd.h: new entry Qsortv in AmplExports, plus declarations for handling AMPL tables (a forthcoming extension). func_add.c: add dummy Add_table_handler and Crypto routines (for funcadd() routines that do not check that ae->asl is nonzero before calling these routines, which are meaningful only to AMPL). New routine fpinit(), called by jac0dim, to initialize the floating- point arithmetic if necessary (e.g., on Intel and SGI systems). asl.h, dtoa1.c: rather than redefining strtod (which causes some systems to complain), #define strtod strtod_ASL. Readers: call qsortv rather than qsort (so just one efficient qsort need be loaded). qp_read.c: "invisible" tweak to banish a compiler warning. Mon Apr 12 15:38:16 EDT 1999 writesol.c: fix a bug introduced in the changes of 19990206 that could erroneously cause a "sos" suffix to be written to the .sol file (when, e.g., nonconvex piecewise-linear terms are present) and might have caused some other suffixes not to be returned. Thu Apr 15 15:56:04 EDT 1999 qp_read.c: the change on 19990409 was not invisible on machines with 64-bit pointers. Today's change should correct this mistake. Mon Apr 19 16:49:19 EDT 1999 asl.h, jac0dim.c, sjac0dim.c, makefile*, amplsolv.*, studchk0.c: new routine student_check_ASL(ASL *asl) (whose default version, in studchk0.c, does nothing and whose "standard" alternative, in sjac0dim.c, is equivalent to the old sjac0dim.c and limits problems to 300 variables and 300 constraints), is a routine one can modify to impose restrictions on "student" binaries. Tue Apr 20 17:48:40 EDT 1999 mip_pri.c: account for adjustments by suf_sos(). Note that we now recommend use of the .priority suffix rather than mip_pri(). printf.c: "invisible" tweak (introduction of stdout_fileno_ASL). Wed Apr 28 10:44:10 EDT 1999 pfg_read.c, pfghread.c: fix bug reading problems with defined variables that can be split into sums of terms. Incorrect gradients or a fault during reading were possible. Example: var x{i in 1..4} := i; var y{i in 1..2} = sum{j in 2*i-1..2*i} j*x[j]; var z = y[1] / y[2]; var w = sum{i in 1..3} x[i]*x[i+1]; # splits s.t. zot: z^2 <= 3; # gradient was miscomputed s.t. zap: w >= x[3] + 1; suf_sos.c: honor Fortran: take asl->i.Fortran_ into account when adjusting A_colstarts and A_rownos, and add Fortran = asl->i.Fortran_ to each number in sosbeg and sosind (in analogy with A_colstarts and A_rownos). names.c, writesol.c: take variables and constraints eliminated by suf_sos() into account (in the case of writesol, when wantsol bits 2 and/or 4 are one: the eliminated entities were already accounted for in the .sol file). Thu Apr 29 11:52:14 EDT 1999 makefile.wat: add a backslash (missed in the changes of 19990415). Fri Apr 30 13:59:40 EDT 1999 nqpcheck.c: fix possible fault. (Absent a fault, the bug was harmless). New sigcatch_ASL() will catch various Unix signals and call mainexit_ASL() and permit routines registered with atexit() to be called when the solver is terminated by SIGABRT, SIGQUIT, SIGTERM, or SIGHUP (unless SIGHUP is being ignored when sigcatch_ASL() is called). Fri May 21 17:20:01 EDT 1999 qp_read.c: fix bug in qp_opify's handling of imported functions. readsol.c, rops.c, rops2.c: add some fflush(Stderr) calls. makefile: renamed makefile.u, so one can copy the appropriate makefile.* to makefile, then edit makefile. printf.c, mainexit.c: for use by GUIs, compilation with -DPF_BUF of amplsolver.a (or amplsolv.lib) and of solver interfaces causes fprintf(stderr_ASL,...) to be accumulated in pfbuf_ASL (which is allocated at the first relevant fprintf call and extended if necessary) and, if pfbuf_print_ASL is not null, fflush(stderr_ASL) causes pfbuf_print_ASL(pfbuf_ASL) to be called and pfbuf_ASL then to be freed. Tue Jun 1 23:46:49 EDT 1999 Tweaks for -DKR_headers; have equ_adjust() operate independently of the presolve setting. Thu Jun 3 14:19:03 EDT 1999 makefile.u: correct comment about AIX to "for AIX versions < 4.3". Sat Jun 5 16:24:52 EDT 1999 pfg_read.c, pfghread.c: fix possible fault or worse during gradient computations of an objective or constraint that makes nonlinear use of a linear defined variable that depends on other (necessarily linear) defined variables that do not otherwise appear in the objective or constraint. Example: var x{i in 1..2} := i + 1; var y = 1 - x[1]; # linear defined variable var z = y + 5; # linear def. var., depending on y s.t. c: z*x[2]*(3 + 4*x[2]) = 0; # nonlin. use of z conpval.c: fix bug in Jacobian computations after pfgh_read(): if a common expression appeared in two terms, one involving more variables than the other, then the common expression's contribution to first derivatives was counted twice. Example: (x[1] + x[2] + 1) in var x{i in 1..4} := i + 1; s.t. c: (x[1] + x[2] + 1)*x[2] == (x[1] + x[2] + 1)*x[3]*x[4]; Thu Jun 17 11:42:59 EDT 1999 func_add.c: minor cosmetic changes that only matter to pure C++ compilers; asldate.c not changed. Thu Jun 17 18:41:38 EDT 1999 rops.c, rops2.c: fix botch in "and" and "or" expressions (appearing in the condition expression of nonlinear "if" expressions): the first argument was passed as argument to the second operator. Fri Jun 25 17:50:51 EDT 1999 funcadd1.c: fix a (previously harmless) type error. names.c: fix a bug in obj_name(). printf.c: add #ifdef USE_ULDIV logic for use on DEC Alpha machines running some versions of OSF1. readsol.c: capture solve_result_num. Wed Jun 30 16:12:12 EDT 1999 pfghread.c: fix more bugs with linear defined variables. Very simple ones were sometimes mishandled. Example: # Jacobian matrix was miscomputed after pfgh_read() var x := 1; var a = x; var b = 1 - a; s.t. c: b*(x/x) - 3*b = 1; Another example (different bug) with simple defined variables in which the Jacobian matrix was miscomputed after pfgh_read(): var x := 1; var y := 2; var z := 1; # variant: fix z; var v2 = z*y; var v3 = 1 - y; var v4 = v3; var v5 = x + v2; var v6 = (x + v2) / v5; var v7 = v4 / (v3+5); s.t. c: v6 + v7 = 1; readsol.c: "invisible" tweak (banish harmless warnings). Fri Jul 9 08:34:57 EDT 1999 xp2known.c: Fix a bug in computing constraint and objective values after pfgh_read() with certain uses of very simple defined variables. The bug is related to the one illustrated in the second example of 19990630, but not revealed by that example (but by a more complex one). Wed Aug 4 09:02:13 EDT 1999 xp1known.c: make changes analogous to those to xp2known.c on 19990709. (This is for completeness; we know of no solver using this routine.) obj2val.c: omit an unnecessary "extern int errno;"; errno.h should provide this (or the equivalent). func_add.c, funcadd1.c: unless there is a command-line -i option, look first in $ampl_funclibs for imported functions; if $ampl_funclibs is not available, look (as before) in $AMPLFUNC. Starting with version 19990804, AMPL sets $ampl_funclibs to the full pathnames of the libraries from which functions in the current problem instance were imported. Now -i, $ampl_funclibs, or $AMPLFUNC may contain a newline- separated list of directories and file names, and the names may contain internal spaces. funcadd.h: new fields in struct TableInfo have no affect on the solver interface library. Thu Aug 5 17:42:21 EDT 1999 funcadd1.c, func_add.c: modify -i? output to tell about $ampl_funclibs (and change some calling sequences). Thu Aug 12 21:12:29 EDT 1999 Minor tweaks... funcadd1.c: remove an unused variable. asl.h, jac0dim.c, stderr.c: provide for ill-advised systems (e.g., Red Hat Linux 6.0 for the DEC Alpha) in which static initializations for the form "FILE *foo = stderr;" do not work: compiling the solver interface library with -DNON_STDIO omits this sort of initialization, which is replaced by a call on Stderr_init_ASL() in jac0dim(). Of course, solvers that wish to do something with Stderr before jac0dim has been called will have to first manually invoke (or do the equivalent of) Stderr_init_ASL() when used on such inconvenient systems. fpinit.c: tweak to compile under Red Hat Linux 6.0 for the DEC Alpha. For older DEC Alpha versions of Linux, it may be necessary now to compile fpinit.c with -DUSE_setfpucw . Mon Sep 27 17:13:14 EDT 1999 func_add.c, funcadd1.c: remember imported libraries and recall them at any .nl-reader calls after the first (unless compiled with -DCLOSE_AT_RESET). This became necessary after the changes of 19990804. getstub.c, misc.c: add more calls on Stderr_init_ASL (cf the previous changes). Fri Oct 1 11:00:21 EDT 1999 con[12]ival.c, objval.c: remove redundant #include "errno.h". rops.c, rops2.c, errchk.h: when errno is nonzero, add its interpretation to error messages for library functions whose evaluations fail. (This may help detect spurious setting of errno.) Thu Oct 7 18:01:56 EDT 1999 rops.c, rops2.c: clear errno after calling an imported function. fg_read.c: "invisible" tweak to use op_type.o rather than op_type.hd. makefile.*: try to get dependencies right and omit obsolete names. Thu Oct 14 00:26:12 EDT 1999 Tweaks to many files: 1. Move errno = 0 assignments before x...check() calls, as these calls may evaluate common expressions. 2. Setting want_xpi0 |= 4 causes havex0 and havepi0 to be allocated when primal and dual initial guesses are present. 3. New, experimental routine fg_write can write a binary or ASCII .nl file, possibly adding new linear variables, constraints, objectives; normally used with new reader fg_wread(), a variant of fg_read() which, like qp_read(), leaves operation numbers rather than function pointers in the "op" fields. (A subsequent call on qpopify() can make it possible to evaluate nonlinear expressions, but fg_write requires the operation numbers.) New examples/nlcopy.c illustrates use of fg_wread and fg_write. 4. New bits in the flag argument to the .nl readers: ASL_keep_all_suffixes ASL_omit_all_suffixes ASL_keep_derivs ASL_allow_missing_funcs ASL_forbid_missing_funcs The first can be used by any reader (but is mostly for fg_wread); the latter are only for fg_wread. Fri Nov 19 16:55:10 EST 1999 xectim.c: where possible, return the sum of user and system time, rather than just user time. On systems with slow software for gradual underflow, it is possible to contruct examples where this makes a significant difference in the reported times. Mon Dec 13 17:00:00 EST 1999 fpinit.c: tweak for Linux (e.g., S.u.S.E. 6.3, Red Hat 6.0); asldate.c not changed. Wed Dec 15 13:30:46 EST 1999 dtoa.c, dtoa1.c: tweak to bypass a bug with HUGE_VAL on HP systems. Thu Feb 3 23:18:24 EST 2000 funcadd.h: new fields in AmplExports. asl.h and several *.c files: struct Edaginfo now has a pointer to an AmplExports, rather than the complete structure, so that future additions to AmplExports will not require recompiling everything. This change does require make recompiling the whole library necessary, as well as any solver objects that depend on asl.h or funcadd.h. New variant fpinitmt.c of fpinit.c for Win32 binaries; makefile.* adjusted. Thu Feb 10 17:31:13 EST 2000 pfg_read.c, pfghread.c: fix a bug (division by zero resulting in NaNs) that arose in a complicated use of defined variables. sphes.c: fix a probably harmless reference to an uninitialized variable. Wed Feb 16 19:13:18 EST 2000 nqpcheck.c: adjust to cope with <<0;0,0>>x*x with AMPL versions < 20000216, which gave 0*x*x rather than 0. Thu Feb 17 18:21:17 EST 2000 pfg_read.c, pfghread.c: fix a bug in handling sums of three or more terms each involving a nonlinear expression with a sum of three or more terms. The bug caused a surprising error message in the example that led to finding the bug, but could cause unpredictable behavior in general. Sun Mar 5 22:07:29 EST 2000 objval.c: fix bug in evaluating defined variables: defined variables appearing only in single constraints were evaluated during objective function evaluations; under unusual conditions, this could lead to an error being reported in the evaluation of the objective. pfg_read.c, pfghread.c: fix some bugs in Jacobian and Hessian evaluations involving a defined variable that is an affine function (linear function plus constant) of a single problem variable. makefile.u: comment on -DNON_STDOUT. func_add.c: add #ifdef NO_tempnam lines for systems without a tempnam function. Mon Mar 6 12:35:27 EST 2000 pfg_read.c, pfghread.c: minor "invisible" tweak to recycle a bit more memory. Wed Mar 8 13:49:57 EST 2000 Fix minor printf glitch: printf "%.0f\n", .1; printed "0." rather than "0" -- under "%.0f", numbers less than 1 in absolute value that do not round to 1 or -1 should print as "0" with no trailing decimal point. Wed Mar 15 12:42:05 EST 2000 pfg_read.c, pfghread.c: fix another botch with linear (affine) defined variables: scaling was lost in linear references. For example, in var x; var y = 3*x; s.t. zot: sin(x) - 4*y == 1; the factor (-4) in zot was lost. asl.h, con1ival.c, con2ival.c, con2val.c, conpval.c, conval.c, obj2val.c, objval.c: tweaks to avoid redundant work with some combinations of calls. fg_write.c, readsol.c: "invisible" cleanups. Fri Mar 17 22:46:32 EST 2000 arithchk.c, makefile.*: On Unix/Linux systems, account for the effects of fpinit_ASL when deriving arith.h. On SGI systems using the n32 or 64 ABI, this causes Sudden_Underflow not to be #defined. Sat Mar 18 23:22:24 EST 2000 func_add.c: fix bug introduced 19990804 in handling imported functions when two or more .nl readers are called. (This affects loqo, which may call both qp_read and pfgh_read.) Mon Mar 20 16:55:45 EST 2000 Minor tweaks for compilation with -DKR_headers (files asl.h, fg_read.c, fg_write.c, func_add.c, funcadd1.c). Mon Mar 27 01:33:59 EST 2000 pfg_read.c, pfghread.c: fix bugs in handling defined variables in certain complicated situations (e.g., on Vanderbei's hs090.mod). One bug arose under AMPL's "option linelim 1". Tue Mar 28 11:20:09 EST 2000 pfg_read.c, pfghread.c: fix glitch with nonlinear "if" expressions with constant "then" or "else" expressions and with "min" or "max" expressions having a constant operand: a fault was possible during expression evaluations (after reading). Tue Apr 4 11:52:52 EDT 2000 pfg_read.c, pfghread.c: fix yet another bug with defined variables: if a nonlinear defined variable appeared linearly in an objective and could be split into several terms, each depending on a different set of variables, and if linear combinations of variables appeared nonlinearly, incorrect derivative computations could result. Thu Apr 27 19:17:20 EDT 2000 New field AI of type AuxInfo* in AmplExports. It can be assigned by auxinfo_ASL() to provide general kinds of auxiliary information. The (new) default auxinfo_ASL in amplsolver.a (amplsolv.lib) simply assigns AI = 0, but solvers can provide their own auxinfo_ASL to provide more interesting values. opcode.hd moved from directory ampl/solvers/nlc to ampl/solvers for more convenient use by other solver drivers. Wed May 3 07:53:14 EDT 2000 New subdirectory lbfgsb with an interface to L-BFGS-B, which minimizes or maximizes a differentiable objective subject only to simple-bound constraints. See Algorithm 778, ACM Trans. Math. Software 23 #4 (1997), by Ciyou Zhu, Richard Byrd, Peihuang Lu, and Jorge Nocedal. Fri Jun 2 08:57:49 EDT 2000 fpinit.c: new section for Solaris on i386 machines. New fpsetprec.s for use with fpinit.c on Solaris i386 systems. getstub.c: "invisible" tweak for readability. pfg_read.c pfghread.c: fix some bugs with defined variables: definitions of the form var x = if something then 1 else 2; where both the "then" and "else" clauses were constant almost everywhere were mishandled, and definitions that could be split apart (while identifying partially separable structure) were sometimes mishandled. Here is an example that caused a fault in pfgh_read(): var a := 0; var b := 2; var c := 3; var x = if 2 <= a then 2 else b + c; var y = if 2 <= a then 0 else -2; var z = 2*x + y^2; minimize zot: z; Thu Jun 8 19:13:13 EDT 2000 func_add.c, funcadd.h: new ae->Getenv and #define for char* getenv(const char*) mainly for use in AMPL sessions to let imported functions and table handlers access the current environment (as modified by option, environ, and problem commands). Only use getenv in imported functions (in the form (*al->Getenv)) if ae->ASLdate >= 20000608. func_add.c: fix glitch that could result in "_fileno" reported as missing on some systems. Mon Jul 3 11:44:29 EDT 2000 Tweak to fpsetprec.s for use with fpinit.c on Solaris i386 systems. (Adjust stack to allow interrupts to intervene in fpsetprec().) asl.h, basename.c, getstub.c: change "basename" to "basename_ASL", to avoid (rare) trouble on hostile systems. rops.c, rops2.c: "invisible" tweak (change "round" to "Round") to avoid trouble on other hostile systems. Fri Jul 7 08:40:36 EDT 2000 funcadd1.c: when loading a library to import functions, arrange for subsequent unloading of the library to happen after any at_exit() or at_reset() processing requested directly or indirectly by addfunc(). (This matters to an experimental facility for importing Java functions.) der0prop.c withdrawn (unused). Various files: adjustments to permit compilation by C++ compilers. Thu Jul 20 11:03:28 EDT 2000 basename.c: omit an 0x01 visible under -DKR_headers, introduced on 20000707. pfg_read.c, pfghread.c: fix bug in handling nonlinear defined variables that appeared linearly in an objective or constraint and involved the sum of two or more terms involving different sets of variables (so they could be split into a sum of defined variables to make Hessian computations more efficient). If introducing a linear change of variables also helped and was discovered at the "right" time, incorrect derivative computations resulted. Example: var x{i in 0..2} := .1; var v3 = 1 / x[0]; var v4 = x[1] + 5*x[2]; var v5 = v3 - x[1]*v4; minimize foo: v5 + x[2]*v4; Correcting this bug involved changing one line from ce->z.i = ka; to ce->z.i = k < Ncom ? ka : ((expr_vx*)varp[k-Ncom])->a0; but today's changes also include an "invisible" adjustment to the a1 field of struct expr_vx. Thu Jul 27 21:41:42 EDT 2000 Extend comments in makefile.u about Solaris on the i386 architecture. Thu Aug 3 13:44:35 EDT 2000 funcadd1.c: mostly invisible addition of "#undef mymalloc". jac0dim.c, misc.c: move Stderr_init call to ASL_alloc() (a change invisible on most systems, but relevant to some solvers, such as cplex, on some Linux systems, if the solver issues an error message too soon). getstub.c: usage_ASL(): call Stderr_init if necessary. Tue Aug 22 23:36:17 EDT 2000 New genrowno.c defining gen_rownows_ASL (#defined as usual to apparent prototype void gen_rownos(void)): solvers that handle sparse nonlinear constraints and wish to have Jacobian nonzeros stored sparsely by columns in A_rownos may simply call gen_rownos() after calling the .nl reader (with A_vals left at its default value = NULL). Mon Aug 28 14:32:32 EDT 2000 pfg_read.c, pfghread.c: fix bug on systems with 64-bit addresses that caused, e.g., miscomputation of gradients with problem "hs105" (/netlib/ampl/models/nlmodels/hs105.mod). Wed Aug 30 01:11:01 EDT 2000 pfg_read.c, pfghread.c: fix a bug with pfgh_read(nl, flags) when one or both of the ASL_find_co_class bits of flags is on: wrong c_class or o_class values (or a fault due to an out-of-bounds subscript) could result if the bug bit. All readers: fix bug (out-of-bounds array reference) in some cases when asl->i.nlvog has been assigned a positive value. (Of the sample drivers in /netlib/ampl/solvers subdirectories, only minos/m55.c and snopt/snopt.c do this.) jac0dim.c jacinc.c: adjust x0len to only consider nonlinear variables when deciding whether nonlinear information must be updated. Tue Sep 5 13:17:01 EDT 2000 pfg_read.c, pfghread.c: fix a bug in computing derivatives that arose under complicated conditions: a defined variable could be split into the sum of two or more defined variables and appeared in an expression complicated enough that "funneling" the expression led to more efficient derivative computations. Example: var x{1..2} >= .6 <= 1 := 1; var y{i in 1..2} = .5*x[i] + 1; var z{i in 1..2} = .25*y[i] + 3; var w = (1 + (y[1] - y[2])^2) / z[2] # split + (y[1] - 7) / z[1]; s.t. zot: w + x[1] + x[2] == 0; # first term of w funneled Tue Sep 12 15:38:38 EDT 2000 nqpcheck.c: for constraints, when a quadratic form involves a constant term, update the constraint upper and lower bounds rather than adjusting the value of the constraint body. Mon Oct 2 15:45:39 EDT 2000 pfg_read.c, pfghread.c: fix bug only possible with inappropriate use of "option presolve 0" resulting in constant "defined variables". All nonlinear .nl readers: fix botch in computing bounds (LUrhs, Urhsx) on constraints involved in complementarity conditions. The bounds were supposed to be redundant with those implied by the cvar array. Solvers, such as PATH, that just used the variable bounds are unaffected by this bug fix. Fri Oct 6 10:21:04 EDT 2000 pfg_read.c, pfghread.c: cope with 0*variable, which prior to AMPL version 20001006 could arise from expressions of the form v1*sum{i in A} p[i]*v[i], where v and v1 are variables and p[i] == 0 for all i. Mon Oct 9 17:03:24 EDT 2000 funcadd1.c: fix a possible fault with use of imported functions. The fault, if it occurred, happened at the end of execution (except under -DCLOSE_AT_RESET, when it happened when ASF_free was called). Wed Nov 1 17:27:49 EST 2000 mach.c: tweak to prevent trouble with optimization by a very recent version of gcc. dtoa.c: "invisible" tweaks (to be detailed in a forthcoming update to /netlib/fp/changes). Fri Nov 3 09:28:10 EST 2000 funcadd.h: correct comment describing FUNCADD_012ARGS, which is for *random* real valued functions; asldate.c not changed. dtoa.c: sync with /netlib/fp/dtoa.c Fri Nov 10 17:43:07 EST 2000 pfg_read.c, pfghread.c: fix glitch with constant-valued defined variables (which can arise with "option presolve 0" -- a bad idea in general): they were evaluated at twice their correct value. All nonlinear .nl readers: in calls on imported functions with expressions involving variables in the argument list (so al->derivs and, if relevant, al->hes will be nonzero), initialize all components of al->derivs and al->hes to zero. Previously, only the al->hes components were so initialized. Mon Nov 13 22:54:19 EST 2000 pfg_read.c, pfghread.c: fix a performance bug with defined variables that sometimes resulted in explicit constant zeros in sparse Hessians. The bug bit when, say, the objective made linear reference to a defined variable that itself was the (possibly weighted) sum of defined variables. Example: param N default 3; set I := 1..N; set T default 1..2; set P := {i in I, j in i+1..N}; var d{P,T} >= 0.01 := 1; var p{(i,j) in P, k in T} = (i+j)/d[i,j,k]; var r{k in T} = 12*sum{(i,j) in P} p[i,j,k]; var t = sum{k in T} 2*r[k]; minimize zap: .05*t; The computed Hessian had explicit zeros in the (i,j) positions for all i < j. Wed Nov 15 17:40:13 EST 2000 nqpcheck.c: fix bug in handling defined variables that are the sum of two or more quadratic terms. Example where the bug bit: set I := 1..2; var x{i in I} := i; var y = 7*sum{i in I} (x[i]/(i+1))^2; minimize zot: 10*y; On this example, ampl/solvers/examples/qtest reported objective value 17.5 rather than 48.6111111111111. misc.c: correct names in some error messages for incorrect usage (calls out of sequence). Fri Nov 17 16:57:18 EST 2000 fg_read.c: fix a bug that could only manifest itself under unusual circumstances: calling fg_read() after assigning want_derivs = 0, with top-level "if" or "min" or "max" expressions, as in "nlc -1 foo", where foo.nl comes from var x {1..3}; s.t. c: min (x[1],x[2],x[3]) = 5; misc.c: banish register declarations ("invisible" tweak). Thu Dec 28 18:44:14 EST 2000 pfg_read.c, pfghread.c: fix a bug in handling chains of defined variables of the form v[i+1] = v[i]. The smallest known example where the bug bit is the rather baroque var v0 >= 0 := .02; var v1 >= 0 := 13.23; var v2 := -1.288; var v3 := -1.288; var v4 >= 0 := 13.23; var v5 = .5*v0*(v2 - 1.288); var v6 = v5 + .5*v0*(v2 + v3); var v7 = v6 + .5*v0*(v3 - 1.288); var v8 = v7; var v9 = v8; var v10 = v9; minimize zot: v4; s.t. c0: 60.536*v0 - v10 = 100; s.t. c1: -.5*v0*(v1 + 13.23) = -.2646; When it bit, the bug caused incorrect Jacobian evaluations. Tue Jan 2 18:51:43 EST 2001 asl.h: tweak to permit making Win32 DLLs that access stdio by starting with #define NO_STDIO1 #define Permit_AE_redefs #include "asl.h" and arranging separately to make "ae" visible; asldate.c not changed. Mon Jan 15 17:09:34 EST 2001 conpval.c, pfg_read.c, pfghread.c: fix Hessian bug in handling unary(unary(terms(x)) where terms(x) is the sum of two or more terms involving different subsets of the variables x. Example: var x{1..2} := .5; minimize zot: sin(-(x[1] + x[2])); Note the -(), i.e., negation, is a unary function. Tue Jan 16 13:30:39 EST 2001 rops.c, rops2.c: reorder partial derivative computations for x^y and x^c (constant power) to avoid trouble when x^y or x^c underflows to zero. Wed Feb 7 13:15:13 EST 2001 dtoa.c, dtoa1.c, atof.c: obscure bug fixes (see /netlib/fp/changes). Thu Mar 22 14:07:07 EST 2001 funcadd.h: fix a typo in a comment (s/funcadd/addfunc/). misc.c: tweak to permit reading ASCII .nl files massaged to have either Microsoft (\r\n) or Macintosh (\r) end-of-line notation. Fri Apr 27 18:01:04 EDT 2001 suf_sos.c: fix a glitch that will matter to MIP solvers that handle SOS2 sets once AMPL's forthcoming "variable in union of intervals" extension is available. A fault was possible. Wed May 9 23:36:02 EDT 2001 printf.c: Have printf("%s",0) print "" rather than fault. This affects both solvers and imported (user-defined) functions. funcadd.h: add some #ifdef _WIN32 goo for added flexibility. Thu May 10 17:34:16 EDT 2001 qp_read.c: fix a bug in qp_opify that would cause a fault when it bit. con1ival.c, con2ival.c, conpval.c, conpvaldb.c, obj2val.c, objval.c: trivial adjustment: use M1zapalloc() instead of M1alloc and memset. Wed May 23 13:16:03 EDT 2001 suf_sos.c: fix bug (mis-ordered statements) that could bite on problems with both nonconvex piecewise-linear terms (linearized by AMPL) and explicit .sosno and .ref suffixes. When processing .sosno and .ref, sort SOS1 members on increasing .ref values. Adjust for possible use with nonlinear solvers: if A_vals is null, adjust Cgrad and con_de to reflect removed constraints. asl.h, suf_sos.c: add recognition of bit ASL_suf_sos_just_SOS1 in the flags argument to suf_sos(). If this bit is set, SOS2 constraints added by AMPL while transforming nonconvex piecewise- linear terms are retained and just the associated SOS1 constraint is removed. getstub.h, value.c: add FI_val for a fint value in a known place. sphes.c: in the call sphes(h, no, ow, y), if 0 <= no < n_obj and ow is nonzero, use weight ow[no] rather than 1. for the objective. fpinit.c, makefile.u: for more flexibility on Linux systems, add "#ifndef NO_fpu_control" logic to fpinit.c and a comment on it to makefile.u. Thu May 24 08:45:36 EDT 2001 suf_sos.c: change to ASL_suf_sos_just_SOS1 bit: if on, retain all constraints added when linearizing nonconvex piecewise-linear terms. Thu May 31 17:10:29 EDT 2001 conpval.c objval.c xp[12]known.c: add some missing "err_jmp = 0" assignments (to prevent trouble under unusual conditions -- most solvers are unaffected). Sundry files: adjust all Hessian computations to treat arguments (nobj, ow) the same as in last week's change to sphes.c: if ow is nonzero and 0 <= nobj < n_obj, use weight ow[nobj] rather than 1. Also add interlocks to make it true for sphes() that the Hessian is computed at the most recent primal variables x passed to any of the function or gradient routines (congrd, conival, conval, jacval, objgrd, or objval) or to xknown() or xknowne(). Hitherto explicit previous gradient computations were required on problems with "group" partially separable structure. Fri Jun 1 11:38:31 EDT 2001 Fix glitches in compilation with -DKR_headers. Correct yesterday's changes to make Hessian computations right when nonlinear gradients of relevant functions lacking "group" partially separable structure have not been computed at the current x. For hvcomp(), assigning asl->i.x_known = 2 before a series of calls on hvcomp turns off the tests that would bring gradient information up to date. This saves overhead and is appropriate if the program logic ensures that all relevant gradients have been computed at the current x. If you do this, be sure to invoke "xunknown();" after the series of hvcomp calls. Header file changes yesterday and today make it necessary to recompile solver source files that include asl_pfgh.h or jacpdim.h. Sat Jun 2 01:01:42 EDT 2001 Shortly after the previous update, Bob Vanderbei reported a new bug: after pfgh_read(), first derivatives were miscomputed when a unitary function was applied to a sum of three or more nonlinear terms, two or more of which involved the same "internal variables", such as x+y and x-y in the following simple example: var x := -1; var y := 1; minimize f: sqrt((sin(x+y) + (y-x))^2 + (y-x+1)^2); Sat Jun 2 17:07:48 EDT 2001 conpval.c: fix a new fault with calls on duthes, fullhes, sphes, or hvcomp with y = 0. asl.h: add #define for hvinit() with apparent prototype void hvinit(int nobj, real *ow, real *y) which should be called before hvcomp when calling hvcomp at the same x (primal variable values) but different (nobj, ow, y). objval_.c: add corresponding Fortran (f77) callable subroutine hvinit(nobj, ow, y) integer nobj double precision ow(*), y(*) duthes.c, fullhes.c, sphes.c and xp2known.c: change default hesset() calls to make all nonlinear objectives and constraints available for Hessian computations. Though not yet described in "Hooking Your Solver to AMPL", hesset() with apparent prototype void hesset(int flags, int obj, int nnobj, int con, int nncon) has long been #defined in asl.h. It must be called once after pfgh_read() to indicate which objectives and constraints will participate in Hessian computations: objectives obj <= i < obj + nnobj and constraints con <= i < con + nncon will subsequently be considered (with obj = 0 for the first constraint and con = 0 for the first objective). Currently, the flags argument should be 1. Since problems may be declared to have more than one objective, when treating objective nobj (0 <= nobj < n_obj), it is best to invoke hesset(1,nobj,1,0,nlc) after pfgh_read() so only the desired objective will affect the sparsity pattern presented to the solver (when using sphes()). When there is no objective, use obj = nnobj = 0, as in hesset(1,0,0,0,nlc). Thu Jun 7 17:37:42 EDT 2001 asl.h, pfg_read.c, pfghread.c: change to interpretation of flags argument to pfg_read and pfgh_read: unless ASL_find_default_no_groups appears in flags, assume ASL_findgroups. When ASL_find_default_no_groups appears, only explicit specifications of ASL_findOgroups, ASL_findCgroups or ASL_findgroups are now honored. Thus pfgh_read(nl,0) would now be "normal" usage, as it's generally desirable to have the increased efficiency that finding group structure can bring. One exception is lancelot, which only wants to see group structure for objectives. The sample driver for lancelot is updated accordingly. Fri Jun 15 13:44:38 EDT 2001 conpval.c: fix a glitch in the changes of 20010531: objgrd rather than congrd was called to compute partials needed for Hessian computations (under apparently unusual conditions). In the example behind this correction, the bug caused the surprising error message objpgrd: got NOBJ = 1; expected 0 <= NOBJ < 1 Tue Jun 19 00:41:37 EDT 2001 makefile.u: change "a.out" to "./a.out" (in case $PATH excludes "."). Wed Jun 20 16:36:55 EDT 2001 fpinit.c: use IEEE default exception mask with FreeBSD. Mon Jun 25 15:11:43 EDT 2001 arithchk.c, makefile.u: add (undesirable) #ifdefs to simplify makefile modifications needed for Intel Solaris. Mon Aug 13 23:47:27 EDT 2001 fpinit.c, funcadd1.c, makefile.*: omit WIN32 in favor of _WIN32 (which is predefined by the WIN32 compilers in WIN32 mode). fpinit.c: provide "#ifdef ASL_NO_FP_INIT" for examples/amplfunc.c. examples/amplfunc.c and spamfunc.c: under _WIN32, include fpinit.c with ASL_NO_FP_INIT #defined (to prevent possible surprises). No change to asldate.c. Thu Aug 23 09:42:07 EDT 2001 suf_sos.c: When processing .sosno and .ref, if .priority is available, give each SOS1 and SOS2 set specified by .sosno the maximum priority of any of its variables (rather than the minimum). Wed Feb 6 16:57:53 EST 2002 New function int_catch(void(*f)(int,void*), void *v) lets a solver interface provide a function f such that f(SIGINT,v) should be invoked the first time a SIGINT signal is received. This could instruct the solver to terminate gracefully. Argument v is passed without change to f. Imported functions can also call f as follows: AmplExports *ae = al->AE; if (ae->ASLdate >= 20011004 && ae->Breakfunc) (*ae->Breakfunc)(2, ae->Breakarg); Fix glitches with printf: printf "%3.0f\n", .1; # gave " 0" rather than " 0" printf "%3.-2f\n", 1; # gave " 00" rather than " 0" Fix a memory leak that occurred when sphes_setup() was called with several times with different arguments. Fix a fault in pfg_read() and pfgh_read() in handling a nonlinear defined variable involving (variable expression)*(sum of nonlinear terms), where the linear terms cancel or there are two or more explicit zeros in certain positions. Example (that results in two explicit zeros with AMPL versions prior to 20011218): set I := 1..5; var w{I} := 2 >= 0 <= 5; var x{I} := 1 >= 0 <= 4; var y <= 4 := 1; var z = y * sum{i in I} i*w[i]*x[i]; maximize zot: y*z; s.t. zap: z <= 10; s.t. fix25{i in {2,5}}: x[i] = 0; Here is a uuencoded, gzipped foo.nl resulting from the above with option nl_comments 1; write gfoo; (with an AMPL version prior to 20011218): begin 644 foo.nl.gz M'XL("`"U'SP``V9O;RYN;`"-4CV3FS`0K=E?H1F*G#,4PH!M[LH4F;DF79I, M"H%EK!Q(CB0XGW]]GO@XA^(R&PVFCGK5#:X\-4OV3MU2!QMT(WX92_M:-``T4;W2HMA?V(1G-L+?VK ML2]_PQ[O[(1-9]"#M0H<5#&E/]95&7\>TV`%33-OR0B^$BC8/;%3KT%"G">& MG_Z0)Z5'Y6HKO;P3'UFEM+!O"61XV4C(O I[FA/!WKFK`QQ$(6C$HY*."KAJ(2C$HY*."KA]/5_@7\`*&=WP+@#```` ` end Adjust arithchk.c so it will emit #define NANCHECK in at least some cases when the math library fails to set errno. README is correspondingly modified. asl.h, suf_sos.c: the ASL_suf_sos_just_SOS1 flags bit is withdrawn. In its place is a new routine, sos_add() (source file sos_add.c) for use by solvers that handle integer variables and perhaps know about SOS1 constraints, but do not fully support SOS sets -- e.g., do not supply the convexity constraint that implies the SOS1 condition. For such solvers, one now invokes void *SI = sos_add(nl,flags); before calling the .nl reader. This routine scans the incoming suffixes and arranges for the .nl reader to leave room for adding constraints and variables needed to properly treat .sosno and .ref. After calling the .nl reader, one then invokes either nsos = sos_finish(&SI, flags, &nsosnz, &sospri, copri, &sosbeg, &sosind, &sosref); if the solver wants to know about SOS1 constraints, or sos_finish(&SI, flags, 0,0,0,0,0,0); if not. Both sos_finish invocations are no-ops, returning 0, if SI is null. When SI is not null, both may adjust n_con, nzc, etc. func_add.c: on Linux systems, supply private tempnam and tmpnam (which are only there in case imported functions want to use them on Microsoft systems) to banish warnings about use of dangerous functions. Tue Feb 12 08:29:04 EST 2002 fgh_read.c: omit a check that printed Cgrad[nnn] = 0 on trivial constraints (that are eliminated unless one inappropriately specifies "option presolve 0"). pfg_read.c, pfghread.c: fix a bug in pfgh_read() whereby partially separable constant terms other than numerical constants were treated as zero. Such terms can arise when one (inappropriately) specifies "option presolve 0" in examples with defined variables and fixed variables, such as var x{i in 0..2} := i; var y = x[1] - x[2]; var z = y^2; minimize f: x[0]^2 + z; fix {i in 1..2} x[i]; and in examples with imported functions that are unavailable to the AMPL processor (but available to the solver), as in function ginv; var x; minimize zot: (x-1)^2 + ginv(2); makefile.u: add sos_add.c to the rule for xsum.out. Thu Feb 21 14:07:02 EST 2002 pfg_read.c, pfghread.c: fix longstanding bug in handling unary minus in some contexts: too much got negated (by pfg_read() and pfgh_read()). An example where the bug bit: var x := 1; var y := sin(-1.5); s.t. c1: sin(-.5 + -x) == y; Tue Apr 9 18:44:03 EDT 2002 writesol.c: when invoked by AMPL versions >= 20020401, omit the backspaces that hitherto appeared when properly behaving solvers did not report any option settings. fgh_read.c: omit an unused variable. Mon Apr 22 11:13:39 EDT 2002 sos_add.c: fix bugs in handling fewer new variables than might have been required (because some turned out already to be binary) and in working with pfg_read() and pfgh_read(). Tue Apr 30 18:22:33 EDT 2002 getstub.c: extend Ver_val (for "version") to accept an optional value (as in "version=1"). value.c: use *(unsigned char*) in some comparisons (an invisible change with ASCII characters). Tue May 7 15:58:54 EDT 2002 funcadd.h, func_add.c, printf.c, stdio1.h: make C99 snprintf and vsnprintf available to imported functions when ae->ASLdate >= 20020501. New source file details.c0 meant for conversion to details.c either automatically (under Linux and Unix, where the makefile can use sed and "uname -sr"), or by hand editing (on Microsoft systems). Ver_val now uses char sysdetails_ASL[] (unless it is ""), which can be supplied by details.c or by individual drivers. getstub.[ch]: new field driver_date in Option_Info: if positive, its decimal value should be a date string YYYYMMDD, which will appear with command-line option -v or keyword "version" (if associated with Ver_val -- the recommended arrangement). In the sample drivers in the ampl/solvers subdirectories, YYYYMMDD has now been derived automatically by the mkfile rule sed "s/YYYYMMDD/`Dt -8 $prereq`/" $prereq >$target and explicitly loading $S/sjac0dim.o (or $S/sjac0dim.obj) to make a student version causes "-v" and "version" output to mention "Student ". sos_add.c and the .nl readers: correct dmg misunderstanding of SOS1 sets: at most one variable in an SOS1 set should be nonzero, rather than exactly one. Fix a glitch (leading to an error message about a bad .nl file) using sos_add on problems with defined variables. Wed May 8 16:53:58 EDT 2002 sos_add.c, suf_sos.c: adjust to avoid a fault when used with a forthcoming AMPL extension for "var in union_of_intervals". Mon Jun 17 14:07:07 EDT 2002 getstub.c: if $solver_msg is an odd positive integer (such as 1), suppress the initial "($solver): " and the echoing of solver options. Sat Jul 13 12:27:02 EDT 2002 printf.c: "invisible" internal tweak (reflected in asldate = 20020627). funcadd1.c: add "#ifdef __APPLE__" stuff for Macintosh OS X. Mon Aug 19 12:17:51 EDT 2002 funcadd.h: add const qualifier to char **sa; asldate.c not changed. Wed Aug 28 23:13:50 EDT 2002 fg_read.c, fgh_read.c, pfg_read.c, pfghread.c: tweak in response to const qualifier added to funcadd.h on 20020819. Obscure bug fix to printf.c, affecting printf, fprintf, sprintf: on systems with IEEE arithmetic, get an explicitly requested sign of zero right under format %+e, e.g., in printf("%+e\n", -0). Thu Sep 5 16:12:38 EDT 2002 Fix a glitch in rarely used routines (xknown and xknowne used with fgh_read()): in x2check.c, supply a missing reset of asl->i.err_jmp_. Fix bugs with calling evaluation routines with nerror nonnull and nonnegative, receiving an evaluation error, then calling another evaluation routine with nerror null or negative and receiving another error. (Such sequences seem unlikely and do not occur in the sample solver drivers in subdirectories of ampl/solvers.) Mon Sep 16 12:57:14 EDT 2002 Trivial change to a format in getstub.c (having no effect with ordinary use of the solver interface library, which uses fprintf = Fprintf supplied by the library); asldate.c not changed. Mon Sep 23 16:30:33 EDT 2002 conpval.c: fix bug in objgrd(np,x,g,nerror) when np > 1 and pfgh_read() is the .nl reader. The linear terms from the first objective, rather than objective np, were used. Wed Nov 13 16:45:28 EST 2002 Fix a bug with use of at_exit() or at_reset() in imported functions: the library was freed before the functions registered with at_exit or at_reset were called, sometimes leading to a fault. Tue Feb 4 23:05:51 EST 2003 makefile.u: add comments for cygwin and MinCW. makefile.vc: add comments for lcc. fpinit.c and fpinitmt.c: minor portability tweaks. sos_add.c: omit an unused static function. Sundry files: updated for CLP extensions (to be documented elsewhere). Recompile everything that depends on header files in the solvers directory. Thu Mar 20 22:50:38 EST 2003 value.c: fix a glitch in FI_val's handling of "?" values (which are supposed to request printing of the current value of the option in question): bogus values were reported. FI_val is for Fortran integer values; only a few solvers (such as filter and minlp) use it. Thu May 29 17:44:56 EDT 2003 conpval.c: fix a bug that could lead to a surprising error message of the form "objpgrd: got NOBJ = 12; expected 0 <= NOBJ < 1" if a Hessian computation was requested after a function evaluation at a point different from the one where the most recent gradient evaluation took place. Also with .nl reader pfgh_read(), fix a bug with objgrd(np,x,g,ne) with non-null ne (and *ne >= 0) and np != 0 (i.e., when treating an objective other than the first): wrong results may have been computed. Sat Oct 18 22:06:09 EDT 2003 conpval.c, pfg_read.c, pfghread.c: fix a bug in handling partially separable functions where an unset variable could cause unnecessary re-evaluations (or under just the right conditions, missed evaluations) of parts of the derivatives. Fri Dec 5 07:28:06 MST 2003 Tweaks to asl.h and sphes.c so when uptri (final arg to sphsetup) is 2, sphes computes the sparse lower triangle of the Hessian (stored column-wise). Thu Jan 22 00:58:11 MST 2004 jac0dim.c: make bswap visible as bswap_ASL (for use in a forthcoming addition to solvers/examples). writesol.c: similary make new write_solx_ASL visible (able to byte-swap while writing). comptry.bat: adjust to permit lots of stuff in CFLAGS (thanks to Erling Andersen for this suggestion). Sun Feb 8 23:07:16 MST 2004 sphes.c: fix a botch in sphes_setup's handling of problems with multiple objectives and arguments (nobj and y) indicating that just one of the objectives is to be used or that constraints are to be ignored in the Hessian: the sparsity pattern was overestimated (encompassing the undesired objectives and constraints). Wed Mar 24 00:42:30 MST 2004 sphes.c: omit declaration of unused variables hr1, hr2; asldate.c not changed. Sun Apr 11 23:39:41 MDT 2004 dtoa.c: update contact info. for dmg and correct page numbers in comment on Steele & White (1990); asldate.c not changed. Sat Aug 21 22:04:17 MDT 2004 makefile.u: minor tweak to permit "make ARFLAGS='-X64 ruv'" (after one has copied makefile.u to makefile and made other necessary changes). getstub.c: add Lic_info_ASL, a char* value that can be set to have show_version_ASL() print license information. pfg_read.c pfghread.c, pshvprod.c: fix bugs (e.g., faults on some problems) with hvcomp. Wed May 11 23:12:43 MDT 2005 sprintf.c: omit an unused variable. pfg_read.c, pfghread.c: use size_expr_n (for benefit of a possible forthcoming nlc extension). misc.c: fix a glitch that only matters with -DNO_STDIO1. Sat Jun 25 23:59:06 MDT 2005 funcadd.c: add a const qualifier to a local variable in function mean(). *read.c: when linear complementarity constraints are present, fold any nonzero right-hand side values into the bounds (LUrhs, Urhsx) on the constraint. Some solvers expect the constant term in linear constraints to be zero, which was always true except for linear complementarity constraints. New bit ASL_no_linear_cc_rhs_adjust in the flags argument to the .nl readers suppresses this adjustment. 20051128 stderr.c, makefile.u: omit possible need for compilation with -DNON_STDIO. getstub.c, punknown.c: portability tweaks for systems with 64-bit pointers (cast to (int) differences in pointers used as arguments for .* format items). xectim.c: obscure tweak to use CLOCKS_PER_SEC in an unusual case. 20060122 func_add.c, funcadd.h: adjust to use size_t rather than unsigned long for sizes, to allow allocating huge memory blocks on 64-bit systems. makefile.vc: add XBINLIBS (an empty string) and comments about modifying it for MS VC++ 7. 20060423 names.c: change _slcon to _slogcon (in names for logical constraints when no .row file is present). 20061007 fg_read.c fgh_read.c pfg_read.c pfghread.c: adjust to handle long character strings (>= 80 characters) in arguments to imported functions when reading ASCII .nl files ("g" format). Long strings in the default binary ("b") format were already correctly handled. arithchk.c: when using binary IEEE (P754) arithmetic, emit #defines for a quiet NaN (a facility not yet used in the ASL or examples thereof). 20061119 fg_read.c fgh_read.c pfg_read.c pfghread.c: only attempt to load amplfunc.dll if the .nl file references imported functions. fpintit.c fpinitmt.c: tweaks for cygwin. New files configure and configurehere. Invoke ./configure to create $OBJDIR/amplsolver.a (with OBJDIR = sys.`uname -m`.`uname -s` unless otherwise specified). Variants of amplsolver.a for several systems can thus be created in system-specific $OBJDIR directories. Invoking ./configurehere creates "makefile" as per former practice. rops.c rops2.c: for functions such as objval and objgrd that take nerror as an argument, set *nerror = 2 when the function but not its gradient can be computed. In this case, if you assign want_deriv = 0; x0kind = ASL_first_x; and repeat the function evaluation, it will succeed (barring subsequent detection of another error), but gradient evaluations will not work properly. To restore gradient computations, assign want_deriv = 1; x0kind = ASL_first_x; before any gradient computations. (For Hessian evaluations to work right, want_deriv = 1 must be in effect during the related function evaluations.) 20061125 README: document ./configure and ./configurehere. configurehere, makefile.u: adjustments for MinGW. 20070124 funcadd1.c: __APPLE__ (for stuff necessary with earlier versions of MacOSX -- how early is unclear) changed to Old_APPLE. Error-message glitch (possible fault, depending on the compiler) fixed. fpecatch.c, asl.h: move definition of fpe_jmpbuf here, renamed fpe_jmpbuf_ASL and now declared in asl.h. (This is mainly of interest on the now rarely seen systems that do not use IEEE arithmetic. Examples of use appear in the sample minos and snopt drivers.) 20070611 configure: correct a comment (omit "and maybe MacOSX"). wrtsol_.c: add variant wrsolw_ of wrtsol_ with Fortran signature subroutine wrsolw(msg, nlines, x, y, wantsol) integer nlines, wantsol character*(*) msg(nlines) double precision x(*), y(*) and new final argument wantsol, with value the sum of 1 for write the .sol file 2 for writing x (primal variables) to stdout 4 for writing y (dual variables) to stdout Change wrtsol_ so the Fortran "call wrtsol(msg, nlines, x, y)" is the same as "call wrsolw(msg, nlines, x, y, 7)". (Previously wrtsol acted like wrsolw with wantsol == 3 rather than 7.) New source file jacinc1.c adds jacinc1_ for a Fortran-callable variant of jacinc(...), with Fortran signature subroutine jacinc1(M,N,NO,NZ,JP,JI,X,L,U,Lrhs,Urhs,Inf,Objdir) integer M, N, NO, NZ, JP(N+1), JI(NZ), Objdir(NO) double precision X(N), L(N), U(N), Lrhs(M), Urhs(M), Inf Compared with jacinc_(), jacinc1_() has two extra arguments, NO and Objdir, with (in Fortran syntax, with first subscript == 1) Objdir(i) == 0 if objective i is to be minimized and Objdir(i) == 1 if objective i is to be maximized, 1 <= i <= NO. Also, JP is of type INTEGER rather than INTEGER*2. Input arguments M, N, NO, NZ are not currently checked for validity. New source file jac2dim.c adds jac2dim_ for a Fortran callable variant of jacdim_ with Fortran signature subroutine jac2dim(stub, M, N, NO, NZ, MXROW, MXCOL) integer M, N, NO, NZ, MXROW, MXCOL character*(*) stub (same signature as jacdim_), which arranges for function, gradient, and Hessian evaluations rather than just the function and gradient evaluations made available by jacdim. stderr.c: add some #ifdef _WIN32 goo so error messages won't fault when the solver-interface library is in a .dll, e.g., when used in a MATLAB mex function. rops.c, rops2.c: make a couple of things (f_OPVARVAL in rops.c, f_OPIMPELSE in rops2.c) externally visible (not file static), in an attempt to bypass a bug in the linker of Microsoft Visual C++ 8. 20070618 fpinitmt.c: change "#ifdef WATCOM" to "#ifdef oldWATCOM", to avoid trouble with the current Open Watcom 1.6. arithchk.c: "invisible" tweaks to banish some compiler warnings. rops2.c: Fix bug in Hessians that involve tanh. 20070619 rops2.c: fix bug in Hessians involveing sinh(x) for x < 0. 20070630 configurehere: tweak for Alpha systems, to get CFLAGS right when cc == gcc. 20070805 sjac0dim.c: add fflush(Stderr) invocation, which matters with MiNGW; asldate.c not changed -- this only affects student binaries. 20070809 funcadd.h: supply a missing */ that only matters for a forthcoming feature. 20070827 pfg_read.c, pfghread.c: fix a fault in Hessian computations involving max or min functions of two arguments. 20070905 Update netlib URLs and some access details in README donlp2/README examples/README minos551/README.1st nlc/README 20070913 dtoa.c, dtoa1.c: make INFNAM_CHECK the default to avoid surprises (since the strtod() logic this implies has been in the C99 standard for some years now). 20070922 xp2known.c: fix a bug that caused a fault in hvcomp on certain (unusual) problems. 20071029 jacinc1.c: omit an unused file-static routine. fpinitmt.c: tweak for use with (new makefile variant) makefile.lc. makefile.u: adjust xsum computation to include makefile.lc. makefile.lc: new makefile variant for use with the PC version of lcc available from http://www.cs.virginia.edu/~lcc-win32/ . Note that lcc's -O misbehaves on some of the source files. 20071103 asl.h, writesol.c: write_solx_ASL replaced by write_solf_ASL and write_solfx_ASL (the former soon to be used in an updated cplex/cplex.c, the latter in an eventually forthcoming examples/solconv.c). 20071111 Add AVL-tree routines (source = avltree.[ch]), for expected later use. 20071118 Make AVL-tree routines politically correct w.r.t. const; add avldelete.c for AVL_delete(...). 20071122 New source file fpsetprec64.s, mentioned in updated makefile.u, for use with Solaris and -xarch=generic64 or -xarch=amd64; asldate.c not changed. 20071128 "Invisible" tweaks to avldelete.c, fg_read.c, pfg_read.c to banish warnings of unused variables. 20071201 misc.c: add "#ifdef _WIN32" stuff to f_OPNUM_ASL to circumvent a Microsoft linker bug (seen under MSVC6 and MSVC8). 20071210 configurehere: adjust for Solaris on Intel (x86) processors. fpinit.c: adjust for Linux on PowrPC. asldate.c: not changed. 20071215 avltree.c avltree.h: Adjust to permit use independent of the AMPL/solver interace library. 20080101 value.c: Extend C_val so =? will show the current value, which will either be (with no quotes) or a string enclosed in double quotes, within which " is represented as "", i.e., is doubled. Allow values for C_val to be enclosed in single or double quotes, in which case the quoting character can appear within the string if it is doubled, so "a funny ""value""" and 'a funny "value"' are treated alike. 20080119 fpinit.c: tweak to fix a #define glitch when making arith.h under AIX; asldate.c not changed. 20080204 avltree.[ch]: add AVL_Tree_alloc2() for supplying free() (for debugging); asldate.c not changed. 20080229 con2val.c: Have jac2dim_ASL call pfgh_read() rather than fgh_read() (for consistency with the Fortran wrapper in jac2dim.c). 20080302 stderr.c: add an explict "= 0" to "FILE *Stderr;" to circumvent a bug with gcc on Macintosh systems; asldate.c not changed. 20080315 dtoa.c: obscure change (to C99 spec) in handling of NaN(...), a change unlikely to affect solvers, but asldate.c nonetheless updated. 20080413 makefile.u: add comment about -D_NONSTD_SOURCE for MacOSX. 20080414 misc.c: adjust "bad line" error message to show the whole offending line for 'g'-mode (ASCII) .nl files. 20080612 fpinit.c: tweak __linux__ case to work when _FPU_IEEE is not #defined; asldate.c not changed. 20080629 configurehere: addition for MacOSX. sphes.c: fix bug in sphsetup (computing the sparsity pattern of the Lagrangian Hessian). Under just the "right" conditions, some nonzeros were missed. Example: var x{i in 1..2} := i; minimize f: x[1]*x[2]*sin(x[1]-x[2]); But with the sin term changed to sin(x[1]-p*x[2]) for any p different from 1, the correct sparsity was detected. 20080630 pshvprod.c: fix a bug in Hessian computations: in if-then-else expressions with one constant "then" or "else" value (and the other involving variables), a bogus nonzero value (such as 7.90505e-323) was mistakenly used instead of zero when the constant value was selected. An example where the bug bit (at the default x == y == 0): var x; var y; minimize f2: x*(if y > 3 then x*y else 2); 20080701 funcadd.h: adjust calling sequence of function type AddRand (which is not yet used, but is planned for use.) 20070707 misc.c: tweak a comment. asl.h: change Intcast from (int) to (size_t) in hopes of fewer warnings on 64-bit machines; asldate.c not changed. fg_write.c: tweak definition of offset_of to avoid warnings. 20080729 fpinit.c: add #ifdef goo for Itanium systems running ALTIX; asldate.c not changed. 20080807 pfg_read.c, pfghread.c: fix bug in pfghread()'s handling of imported functions that had numeric constant arguments before nonconstant ones: partials for the nonconstant arguments were incorrectly referenced. 20080808 pfg_read.c, pfghread.c: fix another bug in pfghread()'s handling of imported functions that had numeric constant arguments before nonconstant ones: second partials for the nonconstant arguments were incorrectly referenced, affecting Hessian computations. 20080828 rops2.c: Fix a bug f_OPPOW (used with pfgh_read()): expressions of the form x^y with x negative and y an integer were not diagnosed as nondifferentiable, but instead gave NaNs in derivative computations. 20080907 printf.c: add C99 %a and %A processing (on IEEE-arithmetic systems). 20081001 funcadd.h: tweak for random functions (a forthcoming feature). configurehere: tweak to allow / in $CFLAGS. asldate.c: not changed. 20081105 printf.c: add include arith.h (when NO_PRINTF_A_FMT is not defined). configurehere: tweak for MinGW. asldate.c not changed. 20081205 dtoa.c: add recognition of C99-style hexadecimal floating-point values (unless compiled with NO_HEX_FP is #defined). dtoa1.c: move #include "stdlib.h" up, to avoid trouble with a recent (2008) version of cygwin that gratuitously #includes stdlib.h. asl.h, misc.c: add functions ASL* get_cur_ASL(void) and ASL* set_cur_ASL(ASL *) to get and set cur_ASL (with set_cur_ASL returning the previous value). 20081211 dtoa.c: omit an unused variable; asldate.c not changed. 20090102 dtoa.c: tweak to banish some compiler warnings; asldate.c not changed. 20090316 comeval.c, xp[12]known.c: fix glitch in assigning cv_index (used in error messages for trouble evaluating defined variables). dtoa1.c, dtoa.c: sync with netlib/fp/dtoa.c. 20090414 dtoa1.c, dtoa.c: sync with netlib/fp/dtoa.c; asldate.c not changed. 20090414 dtoa1.c, dtoa.c: sync with netlib/fp/dtoa.c (fixing a glitch unlikely to affect solver interfaces, but with update to asldate.c). 20090422 rops.c, rops2.c: Complain about inability to compute acosh'(t) for t == +-1. 20090429 getstub.[ch]: add extern char *Lic_info_add_ASL, to which solvers can add arbitrary information (such as a copyright notice) that will appear with command-line invocation "solver -v" for a suitably written solver. 20090430 getstub.c: recognize "--help" as synonym for "-?" and "--version" as synonym for "-v". 20090904 makefile.u: tweak for use with parallel make invocations (which are not useful for making amplsolver.a, but might occur in a context of which the solver interface library is only a part). No change to asldate.c. 20091209 repwhere.c: set errno = 0 at the end (in case it was set by fopen). stdio1.h0: add two #undefs to silence MacOSX warnings. xectim.c: assume -DNO_RUSAGE when _WIN32 is #defined (for MinGW,e.g.). makefile.vc: remove special rule for xectim.obj (no longer needed). 20091215 xectim.c: tweak for an older version of Microsoft Visual C++; asldate.c not changed. 20091229 Various files: add variant optypeb of optype; optypeb treats OPCPOW as binary. This fixes a bug with qp_read supplying nonlinear ops when the problem is not quadratic (which, e.g., affects snopt when all constraints are linear). Fix a couple of obscure bugs in fgh_read(...) (which should be of little interest; pfgh_read(...) is recommended instead). 20100111 dtoa.c: two obscure bug fixes (see /netlib/fp/changes); the changes are not relevant for normal solver use, but asldate.c is updated nonetheless. 20100123 Fix glitch with printf's handling of negative numbers with %a or %A. The sign was ignored that the exponent was wrong. dtoa.c: more obscure bug fixes (see /netlib/fp/changes) only relevant to absurdly long input strings to strtod(). 20100130 dtoa.c: more obscure bug fixes (see /netlib/fp/changes) only relevant to absurdly long input strings to strtod(). 20100707 dtoa.c: an obscure bug fix (see /netlib/fp/changes) that does not affect amplsolver.a; asldate.c not changed. 20100915 dtoa.c: change invisible to ASL (see /netlib/fp/changes); asldate not changed. 20101105 avltree.[ch]: tweaks to AVL_visit to permit interrupting a tree walk. dtoa.c, dtoa1.c: fix a bug that does not affect solvers (but does matter to other uses): strings of more than 40 significant digits were occasionally converted incorrectly when the first significant digit appeared after the decimal point. 20101129 configurehere: tweak for MacOSX: supply -D_NONSTD_SOURCE only if needed. (It is needed under MacOSX 10.5, but not Snow Leopard, which also claims to be MacOSX 10.5.) 20101220 README.f77: add details for gfortran. 20110127 arithchk.c, fpinitmt.c, stderr.c: tweaks for MinGW64; asldate.c not changed. 20110304: dtoa.c: add option of compiling with -DROUND_BIASED_without_Round_Up, which is not appropriate for the solver-interface library; asldate.c not changed. 20110308 stderr.c: under MS Windows, try to cope with a failure of _open_osfhandle(...) by setting Stderr to fopen("con","w"). This may be relevant in a shared library (.dll). 20110321 xsum0.out updated to reflect a modified comment in dtoa.c; asldate.c not unchanged. 20110410 configurehere: add a "2>/dev/null" to silense a spurious message on some versions of Solaris; asldate.c not changed. 20110428 xsum0.out updated to reflect a modified comment in dtoa.c; asldate.c not unchanged. 20110620 configurehere: fix a misplaced backquote in the change of 20110410; asldate.c not changed. 20110708 fg_read.c, fgh_rad.c, pfg_read.c, pfghread.c: fix a bug in handling complementarity constraints of the form const + lin complements L <= expr <= U in which "const" is a nonzero numeric constant and "lin" is a linear expression. The const value was lost by pfgh_read(). The bug only bit when the flags argument to the .nl reader did not have the ASL_no_linear_cc_rhs_adjust bit set. asl.h: adjust comment about niv. 20110809 suf_sos.c: fix a bug in counting nonzeros when an explicit SOS set (given by .sosno and .ref) has too few members: only 1 for an SOS1 set, at most 2 for an SOS2 set. avltree.[ch], avldelete.c: avldelete.c folded into avltree.c and withdrawn; new functionality added. See avltree.h for deatils. Many files: KR_header stuff omitted from most files. New enum values that can be "or-ed" into flags argument to .nl readers: ASL_cc_simplify (for simplifying complementarity conditions for impoverished solvers that only want to see complementarities of the form var1 >= 0 complements var2 >= 0), ASL_obj_replace_ineq and ASL_obj_replace_eq (to replace an objective that is a linear expression in one variable with the body of a constraint in which the variable appears linearly and nowhere else), ASL_rowwise_jac (to request row-wise rather than column-wise storage of Jacobians), ASL_want_A_vals (to cause A_vals to be allocated), and ASL_sep_U_arrays (to request allocation and use of Uvx and Urhsx). See comments in asl.h about the new enum values. The entire interface library and anything using its headers must be recompiled. New files mpec_adj.c, mpec_adj0.c, obj_adj.c obj_adj0.c. When ASL_cc_simplify is not used, linking with mpec_adj0.o will give a slightly smaller program, and when neither ASL_obj_replace_ineq nor ASL_obj_replace_eq is used, linking with mpec_adj0.o will give a slightly smaller program. 20110811 conscale.c: fix a sign error in adjusting bounds for s < 0 in varscale(i, s, nerror) and conscale(i, s, nerror). writesol.c: fix a bug in the scaling of returned dual variables after a call on conscale(i, s, nerror) or lagscale(s, ierror) with s < 0. 20110814 asl.h getstub.h sos_add.c: omit recently added "const" in a few places to avoid trouble with badly written solver interfaces. Sensible interfaces use static tables, for which the added "const" keywords eliminated some compiler warnings. No change to asldate.c, which remains at 20110811. 20110822 pfg_read.c, pfghread.c: fix a rarely-seen fault. conscale.c: fix a glitch in Inftest(). 20110824 nqpcheck.c: fix faults introduced 20110809 in, e.g., quadratically constrained problems as handled by cplex and xpress. 20110826 suf_sos.c: fix a glitch (possible fault) introduced 20110809 while trying to eliminate a spurious compiler warning. 20110913 asl.h: change Sizeof(x) from (fint)sizeof(x) to simply sizeof(x). The old definition was once useful on small machine; recently it caused trouble on a very large problem. New source file indic_cons.c (with updates to asl.h, makefile.*, xsum0.out), to make some code for extracting indicator constraints generally available that was previously only used in the cplex driver (which is being updated to use the new indicator_constrs_ASL() function). 20110916 Allow function evaluations whose derivatives cannot be evaluated to succeed, deferring error reporting until the associated derivatives are requested. For, say, x^1.2 at 0, whose first but not second derivative can be computed, with pfgh_read(), the gradient evaluation will complain, as the Hessian evaluators operate on cached partial derivative values and do not (currently) provide for an error return. Compiling repwhere.c with -DASL_OLD_DERIV_CHECK restores the old behavior; alternatively, assigning asl->p.want_derivs_ = 2 before the desired evaluations restores the old error handling, and assigning asl->p.want_derivs_ = 1 gives the new error handling. Compiling misc.c with -DASL_OLD_DERIV_CHECK changes the default asl->p.want_derivs_ from 1 to 2. Add "#ifdef WANT_INFNAN" logic to rops2.c. (It was already in rops.c.) Compiling rops.c and rops2.c with -DWANT_INFNAN will cause them to return Infinities or NaNs in some cases where they would otherwise report evaluation errors. Catch some Hessian errors (by default) in some corner cases of x^y, e.g., for x^1.2 at x == 0, for which incorrect values were previously supplied. 20110927 suf_sos.c: fix a fault introduced 20110809 when Cgrad == 0. repwhere.c: tweak to avoid a compiler error with archaic compilers. 20110928 suf_sos.c: fix an off-by-one bug (introduced 20110809) that could cause a fault. 20111003 indic_cons.c: allow double inequalities (and sequences of constraints separated by && or given by a forall{...} construct) in indicator constraints. 20111005 writesol.c: allocate a scratch array in a couple of previously missed cases where needed in conjunction with flags ASL_obj_replace_eq and ASL_obj_replace_ineq to the .nl reader. 20111011 xectim.c: on MS Windows systems, have xectim_() return the sum of times in all threads, just as it does on on Unix-like (Posix) systems. 20111014 htcl.c: fix a glitch that only matters when MULTIPLE_THREADS is #defined: change NEW_MBLK_LOCK to MBLK_LOCK. conscale.c: fix a mistake in the changes of 20110811 affecting infinite bounds with negative scalings. 20111018 mpec_adj.c: adjust zerograds to reflect the number of variables after problem adjustments (to prevent out-of-bounds array references when zeroing gradient components of unused variables). This only matters on problems with complementarity constraints when the .nl reader has ASL_cc_simplify set in its flags argument. sphes.c: after sphsetup(-1,1,1,uptri), allow sphes(h,-1,ow,y) with ow == 0 or y == 0 (or both, giving all zeros in h). 20111111 makefile.vc: add comments and "fpinitmt_cl64.obj" rule for use with Microsoft's 64-bit cl compiler, which does not correctly support the C standard. 20111117 fg_read.c, fgh_read.c, misc.c, pfg_read.c: fix a glitch with flag ASL_keep_all_suffixes to .nl readers: not all suffixes were kept. 20111120 obj_adj.c, suf_sos.c: fix a bug that could cause an out-of-bounds array reference (possible fault) in write_sol(). 20120117 For the seldom-used -ix command-line option, in addition to allowing multiple files on separate lines of a suitably quoted x, allow multiple files on the same line if each file name is enclosed in single or double quotes. Add a brief explanation of multiple files to the "-i?" output. Fix a glitch that prevented an error message from appearing when -ix gives an inappropriate x. avltree.[ch]: add routines AVL_first_ge(), AVL_last_le(), AVL_vfirst_ge(), and AVL_vlast_le() for finding the first element >= or last element <= a specified element. New source file libnamsave.c to facilitate a non-solver use of ASL. New function note_libuse_ASL() for a non-solver use of ASL. Change to search rules for locating shared-libraries, to facilitate using a 64-bit solver with a 32-bit AMPL or vice versa: for a 64-bit solver, if the library name involves '.' and the final '.' is preceded by "_32", change the "32" to "64". Otherwise, if the library fails to load and there is a '.' in the name, insert "_64" before the final '.'. (For 32-bit solvers, the rules are similar, with the roles of "32" and "64" reversed.) printf.c: compiling with -DQUOTIFY makes AMPL's %q and %Q format items available. 20120120 funcadd1.c: under MS Windows, add a test that a proposed DLL has is for the right number of addressing bits. (The Windows LoadLibrary function "works" even for DLLs compiled for the wrong number of bits.) On all platforms, ignore "." in directory names. 20120126 funcadd1.c: for a nonsolver application, have libload_ASL(name,2) give return 1 when name is not found. 20120323 nqpcheck.c: arrange for mqpcheck(n,0,0,0) not to fault with NULL values for Cgrad and Ograd. printf.c: increase a buffer size (an "invisible" change). 20120417 dtoa.c, dtoa1.c: an obscure bug fix (see /netlib/fp/changes) that should not affect solvers. 20120423 dtoa.c: invisible changes; asldate.c not updated. 20120619 opnos.hd pfg_read.c pfghread.c: tweak so division by a constant is gives the same sparsity as multiplication by the constant's reciprocal. 20120624 asl.h, fgh_read.c, fg_read.c, misc.c: pfghread.c, pfg_read.c: move some common operations to misc.c, where they will happen after some problem adjustments. mpec_adj.c: fix bugs in handling problems with integer (including binary) variables. suf_sos.c, writesol.c: tweak to work with some problem modifications. getstub.c, getstub.h: add variant usage_noexit_ASL() of usage_ASL() (same calling sequence: the exit-code argument affects where the usage information is written) that does not exit. This alternate routine may be withdrawn if it we do not see convincing examples of its utility. 20120703 README: adjust to reflect that the tar service of netlib.sandia.gov is no longer available by clicking on "(tar"). URLs of the form ftp://www.netlib.org/ampl/solvers.tar.gz still work (to get ampl/solvers and all its subdirectories at once), as do suitable "send all" requests to netlib@netlib.org. 20120712 README: adjust to reflect that URL http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/ampl/solvers still works. makefile.vc: tweak to allow invocations of the form nmake RUNTIME=... (with makefile copied from makefile.vc) to replace "-MT" with ... . 20120830 asl.h, func_add.c, funcadd.h: Add Addrandinit to struct AmplExports, which is available to imported functions in al->AE. An imported function or, more likely the funcadd_ASL function that makes known the imported functions in an imported-function library, can invoke addrandinit(rsi,v) (i.e., ae->Addrandinit(ae,rsi,v)) with apparent signature typedef void (*RandSeedSetter)(void*, unsigned long); void addrandinit(RandSeedSetter rsi, void*); to have rsi(v,$randseed) called initially with the current value of $randseed (as an unsigned long) and, in an AMPL session, again whenever option randseed is assigned a value. This is meant to supply a new seed for random functions provided by the containing imported-function library. Like calls on at_reset() and unlike calls on at_exit, calls on addrandinit() are forgotten after a "reset;". Note that a "reset;" causes the funcadd_ASL() routines in all currently loaded imported function libraries to be called again. 20121005 misc.c: add progname (if not NULL) to memfailure message. suf_sos.c: fix a glitch with discarding SOS1 sets of size 1 and SOS2 sets of size 2 when explicitly specified by suffixes sosno and ref (a bad idea -- it is much less error prone to use AMPL's <<...>> notation for piecewise-linear terms). 20121016 indic_cons.c: fix some bugs (likely faults) that bit on problems with many logical constraints (more than 6000 in the example behind this bug fix). 20121101 npqcheck.c: call get_vminv_ASL() if necessary to prevent vminv from being inappropriately freed in the subsequent free_block(S). 20121116 nqpcheck.c: take asl->i.nsufext[ASL_Sufkind_var] into account. (This value is set to a positive value, e.g., by the Gurobi driver on problems that have range constraints.) 20121212 fpinit.c and comments in makefile.u: make treatment of Solaris on Intel (i386 or x86_64) self-contained. When Intel 8087 extended-precision registers might be used, fpinit() tries to set the rounding precision to 53 bits, to remove a source of confusion. 20121220 dtoa.c, dtoa1.c: fix a possible one-time race when multiple threads are used for input involving Infinity or NaN. 20130129 dtoa.c, dtoa1.c: fix an obscure memory leak in reading hexadecimal- format number (0x...). This change does not affect any known solver interfaces. See /netlib/fp/changes. 20130213 asl.h: move qsortv declaration ahead of include "funcadd.h" to avoid trouble when Permit_AE_redefs is #defined; asldate.c not changed. 20130328 asl.h, writesol.c: change msg arg to the write_sol* routines from char* to const char*. This should be invisible except for banishing a warning in some solver interfaces. 20130419 pfg_read.c, pfghread.c: fix a bug occasionally seen (with readers pfg_read() and pfgh_read()) in problems having defined variables. 20130530 suf_sos.c: fix a bug in removing SOS1 sets of size 1. Wrong arrays were computed. 20130604 indic_cons.c: fix a bug in handling unary minus (wrong return value, causing indicator constraints to be rejected). 20130606 obj_adj.c: fix a fault that was possible with flags ASL_obj_replace_ineq and ASL_obj_replace_eq to the .nl reader. 20130622 New source file obj_adj.h, and adjustments to makefile.u, nqpcheck.c and obj_adj.c to extend the obj_replace facilities to solvers that request A_vals. Examples: the updated CPLEX and XPRESS drivers, /netlib/ampl/solvers/cplex/cplex.c and /netlib/ampl/solvers/cplex/xpress.c. 20130703 New source files npqcheckZ.c and qpcheckZ.c and changes to many files. New alternative A_colstartsZ to A_colstarts: A_colstartsZ is of type size_t* rather than int* to permit handling problems with 2^31 or more Jacobian nonzeros. New alternatives nZc and nZo to nzc and nzo, of type size_t rather than int. New bits in flags argument to .nl readers: ASL_allow_Z ==> accept problems with nZc >= 2^31, setting the ASL_use_Z bit in flags if nZc >= 2^31. ASL_use_Z ==> populate A_colstartsZ rather than A_colstarts, regardless of problem size. New field hcolstartsZ in SputInfo, of type size_t. For simplicity, both hcolstarts and hcolstartsZ are populated. New source files npqcheckZ.c and qpcheckZ.c provide functions mqpcheckZ, nqpcheckZ and qpcheckZ as alternatives to mqpcheck, nqpcheck, and qpcheck, respectively, taking size_t** rather than fint** arguments for colqp. For jacval() to work with nZc >= 2^31, everything should be compiled with -DASL_big_goff. It is simplest to add "#define ASL_big_goff" to arith.h (after "make arith.h"). This increases memory requirements. Add "ifdef NO_SSIZE_T" lines to arithchk.c to define ssize_t when not provided by the system. 20130801 asl.h, qp_read.c: new rflags bit for internal use: ASL_opified, used in qp_read.c so calls on qp_opify() after the first are quietly ignored. misc.c: fix a bug that caused ASL_use_Z to be ignored. obj_adj.c: adjust for ASL_use_Z; avoid looking at A_vals if there are no obj_replace candidates. 20130822 pfg_read.c, pfghread.c: fix a possible glitch (error message "bad e->a = ...") with Hessian computations when if-then-else, min(...), and max(...) are involved. 20130916 obj_adj.c: fix a fault with ASL_use_Z when ASL_obj_replace_eq or ASL_obj_replace_ineq was specified (in the flags argument to the .nl reader) and there was a linear objective involving just one variable. 20130919 asl.h: adjust calling sequences of internally-used routines con_name_nomap_ASL and var_name_nomap_ASL. names.c, writesol.c: adjust names printed by write_sol() when wantsol & 4 is nonzero and some problem adjustments were done. obj_adj.c: adjust to give correct results with outside manipulations, such as those in netlib/ampl/solvers/cplex/cplex.c for problems with quadratic objectives and constraints. qp_read.c: adjust a loop limit affected by manipulations for ASL_obj_replace_ineq and ASL_obj_replace_eq. 20130920 getstub.c, getstub.h: new bits ASL_OI_tabexpand and ASL_OI_addnewline in the option_echo field of Option_Info affect command-line option -= in getstub(). The ASL_OI_tabexpand bit causes tab expansion and causes each line after the first line of each keyword description to be indented at least as far as the description portion of the first line. The ASL_OI_addnewline adds an extra newline after each keyword description. 20131018 funcadd1.c: if an imported-function library name has "_32" or "_64" before the final "." and fails to load (perhaps after changing "32" to "64" or vice versa, as appropriate), try omitting the "_32" or "_64". getstub.c: fix a glitch in the test on the ASL_OI_want_funcadd bit of Option_Info.flags (used && instead of &). 20131029 suf_sos.c: fix a bug (fault) with ASL_allow_Z and ASL_use_Z. 20131122 nqpcheck.c obj_adj.c obj_adj.h: tweak so qp_opify() need not be included in binaries that will never call it. dtoa.c, dtoa1.c: obscure bug fix, probably irrelevant to ASL. 20131124 nqpcheckZ.c: add comment to force recompilation due to changed nqpcheck.c. 20131209 dtoa.c, dtoa1.c: minor performance improvement; see netlib/fp/changes. 20140131 indic_cons.c: generalize to handle linear_expr op linear_expr, e.g., b == 1 ==> linear_expression == linear_expression, rather than just constant op linear_expr or linear_expr op constant, with op one of ==, !=, >=, <=. 20140205 obj_adj.c: fix a glitch (missed adjustment of nZc) with 64-bit binaries and problems read with flag ASL_use_Z to the .nl reader. 20140305 obj_adj.c: fix missing initialization of od->cg (to 0). In many cases, the value would already have been 0, but a fault was otherwise possible. 20140313 nl_obj.c: adjust function nl_obj(ASL *asl, int n) to work properly reader flag ASL_obj_replace_ineq or ASL_obj_replace_eq results in a modified objective. obj_adj.c: correctly update primal and dual initial guesses (X0 and pi0) when reader flag ASL_obj_replace_ineq or ASL_obj_replace_eq results in a modified objective. obj_adj.[ch]: new field cg0 used, e.g., with drivers for MINOS and SNOPT. sscan.f.c: fix a bug with %D that affects the value nZo provided by jac0dim(). nqpcheck.c, nqpcheckZ.c: "invisible" tweaks. makefile.u, makefile.vc: tweaks for obj_adj.h 20140612 amplsolv.sy, makefile.lc, makefile.sy, makefile.wat: apply updates missed in the changes of 20110809. (I no longer have a way to test these files.) 20140617 asl.h com2eval.c conpval.c fgh_read.c jac2dim.h jacpdim.h misc.c pfg_read.c pshvprod.c psinfo.h xp2known.c: new functions with apparent signatures void hvcompd(real *hv, real *p, int co); varno_t hvcomps(real *hv, real *p, int co, varno_t nz, varno_t *z); For -n_obj <= co < 0, hvcompd has the same effect as hvcomp(hv, p, -1-co, 0, 0) and for 0 <= co, it has the same effect as hvcomp(hv, p, -1, 0, y) with y[co] = 1 and other components = 0. Function hvcomps is similar to hvcompd, but it stores the structural nonzeros of Hessian(co)*p in hv and their indices in z and returns the number of nonzeros. Only the first nz values are actually stored; then hv and/or z can be NULL. Type varno_t is int unless the ASL is compiled with -DASL_big_goff, in which case varno_t is ssize_t. (For the latter, you could add "#define ASL_big_goff" to arith.h or stdio1.h.) Previously after a call on hvcomp(hv, p, nobj, ow, y), another call at the same x (primal variables vector) but different (nobj, ow, y) sometimes required an intervening call on hvinit(nobj, ow, y) to function correctly. This is no longer necessary. Because of new components in struct ASL, the entire library needs to be recompiled. 20140618 obj_adj.c: fix a possible fault. 20140709 fg_write.c pfg_read.c qp_read.c stderr.c: change some (long), (Long) or (unsigned long) casts to (ssize_t) or (size_t). Should be invisible. 20140711 printf.c: fix a glitch whereby printf "%x\n", 0xabcd1234; printed "ffffffffabcd1234" rather than "abcd1234" on 64-bit MS Windows systems. 20140718 asl.h fgh_read.c fg_read.c getstub.c jac0dim.c misc.c pfghread.c pfg_read.c writesol.c: add command-line options "-b boundsfile" for a file that supplies primal bounds and an initial guess, overriding those in the .nl file, and "-o solfile" to specify the name of the .sol file. (Compiling getstub.c and misc.c with -DNO_BOUNDSFILE_OPTION disables the new options.) Because of changes to asl.h, the whole library needs to be recompiled. Some of the above, plus con2val.c conpval.c jac2dim.c jacdim.c: argument stub to the jac*dim functions changed from char* to const char*, a change that should be invisible. 20140723 readsol.c: update to reflect AMPL changes over the years. 20140826 getstub.[ch]: suppress echoing options when $solver_msg == 0; add Option_Info.option_echo flag ASL_OI_defer_bsname to print an initial "bsname: " only if options are present (in $solver_options or on the command line). Recognize variants -AMPLln and -AMPLls of -AMPL: -AMPLln assumes ASL_OI_never_echo and -AMPLls assumes ASL_OI_defer_bsname. 20140924 writesol.c: if argument oi to write_sol_ASL, write_solf_ASL, and write_solx_ASL is not NULL and the amplflag is 0, honor the "8" bit of oi->wantsol: echo the solution message only if oi->wantsol & 8 is zero. 20140929 pfg_read.c, pfghread.c: fix a rarely seen bug in pfgh_read() that could cause Jacobians and Hessians to be miscomputed. 20141003 pfg_read.c, pfghread.c: fix trouble introduced in 20140929. The changes of 20140929 worked with some examples, but broke others. 20141004 pfg_read.c, pfghread.c: minor efficiency tweaks, which should eliminate some unnecessary operations under unusual conditions. 20141017 suf_sos.c: update nZc as well as nzc and use size_t variables rather than int variables to update A_colstartsZ. 20141024 conpval.c: fix a bug in lconval() that made it always return 0. dvalue.hd, op_type.hd, op_typeb.hd, opcode.hd, r_op.hd, r_opn.hd, r_opn0.hd, r_qp.hd, rops.c, rops2.c: add logical function f_OPSOMESAME. AMPL versions >= 20141024 can emit logical expressions for constraint programs that involve this operator. The entire library needs to be recompiled. 20141102 repwhere.c, rops.c, rops2.c: make error handling of imported functions behave like that of builtin functions. For example, if an imported function is involved with objval(no, x, nerror) with nerror not NULL, then *nerror should be set appropriately. funcadd.h: adjust comments on Errmsg to say that for errors on first derivative computations, Errmsg should contain a single- quote (') character, and for errors on second derivative computations, Errmsg should contain a double-quote (") character (among others). 20141105 funcadd.h: adjust comments in funcadd.h to say that the text in Errmsg for a failed derivative evaluation should start with a single quote ('), followed by the actual error message text, and similarly, for a failed Hessian evaluation, the text in Errmsg should start with a double quote ("), followed by the actual error message text. 20141106 asl.h: move Stderr declaration below #ifdef __cplusplus lines. This only matters when compiling in C++ mode and does not matter to some compilers, such as g++, but does matter for at least one of the Microsoft compilers. No change to asldate.c. 20141111 repwhere.c, rops.c, rops2.c: fix a glitch that could cause an error message of the form "Error in function %s ... %s" rather than the intended error message in which %s was replaced by something helpful. 20141121 psinfo.h, pfghread.c, pfg_read.c: adjust hashing to work faster on large instances. q_hd.hd: new #define OPPLTERM to be used in updated Gurobi driver. fg_read.c fgh_read.c, pfg_read.c, pfghread.c, asl.h, rops.c, rops2.c: new field "z" in struct plterm to simplify f_OPPLTERM(). (Should be invisible except for slightly faster operation of f_OPPLTERM().) New source file mpqcheckv.c and new type QPinfo in asl.h provide routines ssize_t mqpcheckv_ASL(ASL*, int co, QPinfo **QPIp, void **vp); void mqpcheckv_free_ASL(ASL*, void **vp); which (via #define in asl.h and with asl in scope) can be invoked as ssize_t mqpcheckv(int co, QPinfo **QPIp, void **vp); mpqcheckv_free(void **vp); mqpcheckv() works similarly to mqpcheck(), but may be more efficient when called several times with different values of co. With variables int co; QPinfo *qpi; void *v = 0; in scope, before calling mqpcheckv(co, &qpi, &v) or mqpcheckv(co, 0, &v) the first time, one sets v to 0 (i.e., NULL); mqpcheckv sets v to a value containing temporary arrays useful in subsequent calls on mpqcheckv. After all desired calls on mqpcheckv, one calls mqpcheckv_free(&v) to dispose of the temporary arrays; upon return from mqpcheckv_free(&v), v = 0 again. If the QPIp argument to mqpcheckv() is not NULL, i.e., one invokes mqpcheckv(co, &qpi, &v), qpi is set to NULL when mqpcheckv() returns a value <= 0 and otherwise to a QPinfo structure declared in asl.h: typedef struct QPinfo { int nc; /* number of nonempty columns */ int nz; /* number of nonzeros */ int *colno; /* column numbers of nonempty columns */ size_t *colbeg; /* nonzeros for column colno[i]: */ int *rowno; /* (rowno[j], delsq[j]) for */ real *delsq; /* colbeg[i] <= j < colbeg[i+1], except that */ /* values in colno, colbeg, and rowno are */ /* incremented by Fortran */ } QPinfo; After using the qpi returned by mqpcheckv(co, &qpi, &v), one invokes free(qpi) to dispose of qpi. nqpcheck.c: minor update; should be invisible. makefile* files: updated for mqpcheckv.c. 20141202 mqpcheckv.c: fix a glitch (missed zeroing of an array element) that somehow escaped earlier testing. 20141223 mqpcheckv.c: fix a bug (possible invalid free() call) with problems where ASL_obj_replace_eq or ASL_obj_replace_ineq matters. 20141229 objconst.c: adjust objconst() to work correctly after qp_read(). 20150101 funcadd1.c: tweaks to error messages. 20150107 funcadd.h: change line 271 from "#ifdef _WIN32" to "#if defined(_WIN32) && !defined(__MINGW32__)"; no change to asldate.c. 20150108 obj_adj.c: fix a glitch that caused some solvers (e.g., minos and snopt) to fault on models with a single constraint that obj_adj() folds into the objective, such as var x{1..2}; var t; minimize obj: t; s.t. c: x[1]^2 + x[2]^2 + x[1]*x[2] - 4*x[1] - 5*x[2] <= t; 20150112 asl.h, dtoa.c, dtoa1.c, misc.c: changes for "ifdef MULTIPLE_THREADS". Now ASSUME_OPENMP implies MULTIPLE_THREADS, and when ASSUME_OPENMP is #defined, dtoa1.c provides suitable definitions of ACQUIRE_DTOA_LOCK and FREE_DTOA_LOCK, under the assumption that each thread will use a different ASL* value, so ACQUIRE_DTOA_LOCK(n) and FREE_DTOA_LOCK(n) can be ignored for n >= 2. In this case dtoa1.c also defines void init_dtoa_locks(void); which on some systems (e.g., MS Windows, but not Linux) needs to be called once before the first call on ACQUIRE_DTOA_LOCK(n). The updated misc.c now provides such a call in ASL_alloc(). When MULTIPLE_THREADS is #defined, dtoa.c defines function void set_max_dtoa_threads(unsigned int n); and expects unsigned int dtoa_get_threadno(void); to be available to return the current thread number. After set_max_dtoa_threads(n), calls on strtod and dtoa by threads with thread numbers < n avoid calls on ACQUIRE_DTOA_LOCK and FREE_DTOA_LOCK by keeping thread-specific copies of entities for which changes by other threads would otherwise cause trouble. See the updated comments in dtoa.c about MULTIPLE_THREADS. 20150114 dtoa.c, dtoa1.c: fix a glitch (possible fault) in the updates of 20140112. 20150122 jac0dim.c x2check.c xp1known.c xp2known.c conscale.c con2ival.c con1ival.c con2val.c conpval.c conval.c obj2val.c objval.c: adjustments so after varscale(...) or a problem adjustment that changes the number of variables, objectives and constraints that involve linear variables will be correctly computed by objval(), conval(), and conival() in the unlikely event that only some relevant linear variables have changed but no nonlinear variables have changed. This only affects some solvers (not, e.g., minos or snopt, which treat linear variables separately). names.c: make lon_name() and obj_name() work correctly after problem adjustments that affect the number of constraints the solver sees. 20150126 printf.c: Fix a glitch with format %.0e that caused printf("%.e\n", 4.7); to print "4e+00" rather than "5e+00". 20150129 fpinit.c: Adjustments suggested by Victor Zverovich for Linux on ARM and s390x systems. No change to asldate.c. 20150204 rops.c, rops2.c: fix a glitch with OPREM: the right partial should always be zero. 20150208 fg_read.c, fgh_read.c, pfg_read.c, pfghread.c: fix a bug that could affect solvers that call sos_add() before calling the .nl reader or that specify ASL_cc_simplify in the flags to the .nl reader. Problems with some nonlinear defined variables might sometimes have been mishandled when either some nonzero .sosno or .ref suffixes or certain kinds of complementarity constraints appear in the problem. 20150210 fg_read.c, fgh_read.c, pfg_read.c, pfghread.c: recant most of the changes of 20150208; the "nvinc" logic had made them unnecessary. One change retained: if the incoming X0 or havex0 (i.e., asl->i.X0_ or asl->i.havex0_) are nonzero, only the first n_var components are zeroed initially, rather than the first n_var + asl->i.nsufext[ASL_Sufkind_var] components. 20150216 con1ival.c, con2ival.c, repwhere.c: fix bugs in lconval() and in the objective name shwon in error messages on problems with adjustments due to suf_sos() or reader flags ASL_cc_simplify, ASL_obj_replace_ineq, or ASL_obj_replace_eq. 20150318 misc.c, mpec_adj.c, obj_adj.c: fix a bug that bit when reader flags ASL_cc_simplify caused changes after flags ASL_obj_replace_ineq or ASL_obj_replace_eq had caused changes. objval.c, x2check.c xp1known.c xp2known.c: only copy nonlinear variable values to expr_v structures (saving a bit of time on some problems). pfg_read.c, pfghread.c: fix a possible fault; fix a minor memory leak. 20150427 asl.h, obj_adj.c, qp_read.c: fix a bug (possible fault under some conditions) in some solver interfaces that call qp_read() and allow objective modifications on problems with quadratic constraints and linear objectives. The entire library should be recompiled. mqpcheckv.c, nqpcheck.c, nqpcheckZ.c: for the benefit of interfaces to cplex, gurobi, and xpress, use Cgrad rather than asl->i.Cgrad0, which matters when there are objective modifications. 20150506 New source file degree.c providing function int degree_ASL(ASL*, int co, void **pv); that, after qp_read() or fg_wread(), can quickly tell whether a specified objective or constraint is quadratic. Argument co indicates the desired objective or constrain, as with nqpcheck(): co >= 0 means objective co (0 <= co < n_obj) and co < 0 means constraint -(co+1), 0 <= -(co+1) < n_con. Possible return values: -1 ==> invalid co value 0 ==> constant 1 ==> linear 2 ==> quadratic 3 ==> more general nonlinear The pv argument (of type void **pv) should be NULL if degree_ASL(...) is to be called just once (e.g., to see if the objective is quadratic). If multiple calls are expected (e.g., for objectives and constraints), it may save time to use the pattern void *v = 0; for(...) { ... degree(asl, co, &v); ... } if (v) free(v); 20150509 pfg_read.c, pfghread.c: fix a bug in new_range() -- missing copy of chksum in changes of 20141121 -- that affected problems with more than 256 ranges. 20150512 fpinitmt.c: tweak for gcc 5.0; no change to asldate.c. 20150602 pfg_read.c, pfghread.c: fix a bug in setting the al->dig array passed to imported functions. 20150814 arithchk.c: omit possible generation of "#define NANCHECK" in favor of possibly generating "#define ALSO_CHECK_ERRNO" or "#define CHECK_ERRNO", for use with updated errchk.h. CHECK_ERRNO only arises when none of the library functions now tested returns an Infinity or NaN (when it should); ALSO_CHECK_ERRNO arises when some of the tested library functions set errno but do not return an Infinity or NaN when they should. errchk.h: adjust so on IEEE-arithmetic machines (i.e., most current machines), errchk() will test values returned by library functions to see if they are an Infinity or NaN. The updated errno.h also responds to ALSO_CHECK_ERRNO or CHECK_ERRNO when appropriate. These changes mainly matter for MacOSX and Solaris. mypow.c: when setting errno to EDOM is appropriate, also return a quiet NaN rather than 0. repwhere.c: omit KR_headers stuff (should be invisible). 20150820 stdio1.h0: when _WIN32 is #defined, include stdlib.h before defining perror, to bypass the Microsoft bug (with Visual Studio 2015) that perror may be declared in stdlib.h as well as in stdio.h (where it should appear). No change to asldate.c. 20150828 mqpcheckv.c, nqpcheck.c: fix bugs with columns that are empty due to cancellation. 20150829 mqpcheckv.c, nqpcheck.c: make sparsity computation exact, rather than initially overestimating it and allocating oversize arrays when cancellations reduce the number of nonzeros. 20151005 mqpcheckv.c: fix a bug that caused qpi->nc to be miscomputed on some problems, which could lead to a fault. nqpcheck.c: fix a bug that sometimes caused mqpcheck(asl,co,0,0,0) to return too small a value. 20151007 errchk.h, rops.c, rops2.c: adjust to bypass a gcc bug seen with older gcc versions on x86_64. nqpcheckZ.c: adjust comment (to force recompilation with some makefiles after changes of 20151005). 20151020 dtoa.c: adjustment to dtoa mode 4 that should be invisible to ASL. 20151021 mpec_adj.c: update n_con1 and n_var1 for use in names.c. names.c: use updated n_con1 and n_var1. dtoa1.c: reflect update of 20151020 (to avoid possible confusion with debuggers). 20151026: asl.h: omit the unused #define of CgradZ. con1ival.c, con2ival.c, conpval.c, fgh_read.c, fg_read.c, makefile.*, misc.c, mpec_adj.c, names.c, obj_adj.c, objconst.c, pfghread.c, pfg_read.c: adjust conval() and congrd() to reflect results of flags ASL_obj_replace_eq and ASL_obj_replace_ineq to the .nl reader. Fix bugs with the interaction of these flags and ASL_cc_simplify. Arrange for var_name() to return _svar_aux[...] for variables added by problem adjustments, such as ASL_cc_simplify. comeval.c, derprop.c, duthes.c, fullhes.c, g_fmt.c, htcl.c, qsortv.c, sigcatch.c, wrtsol_.c: trivial changes to quiet pedantic warnings by misguided compilers. 20151209 mqpcheckv.c: fix a bug with diagonal elements that sum to zero and whose rows contain nonzeros to the left but not to the right of the diagonal: the number of columns was miscomputed and a memory overwrite was possible. 20160219 arithchk.c, dtoa.c: sync with netlib/fp; should have no affect on ASL; asldate.c not changed. 20160302 fpinit.c: on non-Windows systems, #include "fenv.h", which helps on at least one kind of system (and should be harmless elsewhere). Thanks to Victor Zverovich for suggesting this; asldate.c not changed. 20160303 funcadd1.c: on most Unix-like systems, give a better error message when a shared library cannot be loaded. 20160307: dtoa.c (and dtoa1.c): Fix glitches with floating-point values in hexadecimal notation (use of which is supported but very unlikely): some values that should overflow to (appropriately signed) Infinity, such as 0x1p1025, were mishandled, and values greater than 0x1p-1075 and less than 0x1.0000000000001p-1075 where treated as zero rather than the smallest denormal number. AMPL does not use hexadecimal notation for floating-point numbers in .nl files, so solvers should not be affected. 20160311 funcadd1.c: when __sun__ is #defined, also #define __EXTENSIONS__ (to avoid compilation troubles). No changes to asldate.c. 20160317 rops.c, rops2.c: fix a bug in the partial w.r.t. y of x mod y. 20160325, 20160429, 20160502, 20160503 dtoa.c, dtoa1.c: sync with netlib/fp; should have no visible effect. 20160504 dtoa.c, dtoa1.c: sync with netlib/fp to fix rare rounding errors in binary-->decimal conversions. With recent changes, starting 20160429, decimal <--> binary conversions are often much faster, though the overall effect on solver performance is likely to be minimal. 20160505 dtoa.c, dtoa1.c: sync with netlib/fp to fix obscure corner cases with directed roundings. Should have no effect on solvers. 20160506 dtoa.c, dtoa1.c: sync with netlib/fp to fix obscure corner cases with denormals and directed roundings. Should not affect solvers. 20160507 dtoa.c, dtoa1.c: sync with netlib/fp to fix strtod overflow tests. Should not affect solvers. 20160508 dtoa.c: strtod: fix rounding bugs with some denormals and with some strings of more than 19 digits; dtoa: fix rarely seen off-by-one bug in the final digit with modes 2 and 3. Should not affect solvers. 20160510 dtoa.c: strtod: fix a glitch that caused some values less than the half smallest denormal not to round to zero, and adjust a test that in rare cases incorrectly avoided a longer computation; dtoa: fix a glitch with -DNO_BF96 -DHonor_FLT_ROUNDS. Should not affect solvers. 20160513 dtoa.c: tighten a test that occasionally falsely indicated sufficiency of an approximate computation. In some difficult but unlikely cases, the value returned by strtod was off by one bit. Fix some tests used with directed roundings that sometimes caused (and dota_r) modes 2 and 3 to return off-by-one values. Thanks to Albert Chan for providing examples. Should not affect solvers. 20160514 dtoa.c: strtod: tighten a variant, missed yesterday, of a test that occasionally falsely indicated sufficiency of an approximate computation. Also apply to denormals a test hitherto only applied to normal numbers for sufficiency of an approximate computation. Should not affect solvers. 20160516 dtoa.c (versions >= 20160429, without -DNO_BF96): fix more glitches with directed roundings. Should not affect solvers. 20160518, 20160521, 20160523, 20160607 dtoa.c: sync with netlib. Very unlikely to affect solvers. 20160608 pfg_read.c, pfghread.c, rops2.c: fix a bug (in a "group partially- separable" context) with x^c for constant c other than c = 2. Wrong values were computed. This only affects solvers that use Hessians explicitly or via Hessian-vector products. 20160611 dtoa.c: sync with netlib. Should not affect solvers. 20160716 pfg_read.c, pfghread.c: adjust to skip looking for "ranges" in the test part of an "if test then a else b" expression and in counting functions (whose derivatives vanish). This is an obscure efficiency improvement. rops2.c: minor cleanup of f_OPPOW; should be invisible. pshvprod.c: fix an obscure bug not not known to affect results. fpinit.c: change __linux__ to __GLIBC__ (which reportedly more portable). 20160831 pshvprod.c: Fix a bug in computing Hessians or Hessian-vector products when the same variable appears alone as the "then" or "else" part of two or more if-then-else expressions. Wrong values were sometimes computed. 20160915 com2eval.c fgh_read.c nlp2.h pfghread.c pfg_read.c pshvprod.c sphes.c: Add case Hv_divLR for division operations when both operands involve variables. On some problems, this gives a slightly sparser Hessian. 20160922 degree.c: enable return 1. (Had forgotten to check for linear terms when no nonlinear expressions are present.) com2eval.c, fgh_read.c, nlp2.h, pfg_read.c, pfghread.c, pshvprod.c, sphes.c: change copyright notice to that in degree.c; code not changed. 20161025 degree.c: fix a bug handling linear defined variables used linearly: degree() could return 0 rather than 1 if nothing else contributed to the objective or constraint being assessed. con1ival.c, con2ival.c, dtoa.c, dtoa1.c, ind_cons.c mqpcheckv.c, nqpcheck.c: tweaks for C++ compilation. xectim.c: adjust to use clock_gettime() unless compiled with -DNO_CLOCK_GETTIME or -DNO_RUSAGE. 20161107 dtoa.c: sync with netlib (at least as seen in http://ampl.com/netlib). No change to asldate.c. 20161118 xectim.c: change "#ifndef NO_CLOCKGETTIME" to "#ifndef NO_CLOCK_GETTIME" (to accord with a comment about compiling with -DNO_CLOCK_GETTIME). No change to asldate.c. 20161208 asl.h, jac2dim.h, jacpdim.h, misc.c, nlp.h, objval.c, psinfo.h, x2check.c, xp1known.c, xp2known.c: change return type of xknown(x) and xknowne(x,ne) from void to int, with return 0 meaning x is the same as before and return 1 meaning x has changed. obj_adj.c: when readers pfg_read(nl,flags) or pfgh_read(nl,flags) were called with ASL_find_co_class in flags, and when an objective is adjusted, also adjust [co]_class and [co]_class_max. 20161228 asl.h, misc.c, fg_read.c: added to Edaginfo (type size_t): temp_rd_bytes = bytes temporarily allocated during .nl read tot_M1z_bytes = total allocated by M1alloc and M1zapalloc rd_M1z_bytes = tot_M1z_bytes after reading the .nl file The whole ASL library needs to be recompiled. 20170429 mqpcheckv.c, nqpcheck.c, objconst.c: fix bugs converting var o; minimize O: o; s.t. c: o = q(x); to minimize O: q(x); where q(x) is quadratic. Linear and constant terms were sometimes mishandled. This only affects some solvers with an "objrep" keyword, such as cplex, gurobi, and xpress. con1ival.c, con2ival.c: fix a possible erroneous error message about an argument being out of range. makefile.u: fix a glitch in the rule for arith.h: change "-DNO_SSIZE_T -DNO_SSIZE_T" to "-DNO_LONG_LONG -DNO_SSIZE_T". 20170509 con1ival.c con2ival.c con2val.c conpval.c conval.c obj2val.c objval.c pshvprod.c repwhere.c x2check.c xp1known.c xp2known.c: fix a bug with defined variables shared by several constraints or objectives: under complicated conditions, it was possible for derivative evaluation errors to be ignored. README: update to describe both the hitherto available "solvers" directory and a new "solvers2" directory designed to be a drop-in replacement for "solvers" for use by solvers that do not make explicit use of expression graphs. For large nonlinear problems, less memory is needed and evaluations are usually faster. With minor changes, solvers that use multiple threads can read the .nl file just once, rather than once per thread. 20170511 getstub.c: tweak so show_version_ASL() always prints a final empty line. 20170515 solvers2.tgz: fix a glitch that caused an error message of the form "bad *o = ... in hfg_fwd". 20170519 fg_write.c: fix an obscure glitch: set want_derivs rather than want_deriv to 0. psinfo.h: add #define for hvpinit(), needed before calling hvcomp(...,no,ow,y) with changed (no,ow,y) at the same x. sphes.c: allow calling sphsetup(no,...) with no >= 0 and later calling sphes(-1,...) when a Hessian only involving constraints is desired. Thus one can sometimes call sphes(no,...) and other times call sphes(-1,...). 20170522 solvers2.tgz: fix a glitch causing "bad *o = 16 in heswork". 20170619 nlp2.h, nlp.h, pfghread.c, pfg_read.c, pshvprod.c, sphes.c: fix a bug with Hessian computations seen in the following example: var x{1..3}; var y9 = 96.82/x[1] + x[2]+x[3]; minimize obj: 1e6/y9; data; var x := 1 900 2 80 3 115; Fix a bug with "Hessian funnels" when defined variables were involved. For now, such Hessian funnels are disallowed. Fix a bug with some very simple "if" expressions as objectives or constraint bodies, e.g., minimize o: if x >= 1 then x^2 else x; and minimize o: if x < 1 then x else x^2; Fix some obscure bugs in solvers2.tgz, including possible trouble (mis-diagnosis of "nonquadratic" forms) on large enough examples. 20170622 pfg_read.c, pfghread.c: fix an apparently rarely-encountered bug computing first and second derivatives with complicated uses of defined variables, seen, e.g., in Bob Vanderbei's formulation of Hock & Schittkowski test problem 85. The bug was not present in solvers2.tgz, which uses somewhat different logic. 20170623 asl.h: add some ASL_write_flags values for use in fg_write(). fg_write.c: reorder output to accord with the ordering change in AMPL version 20160519, and honor the new ASL_write_flags values. nlp2.h: reorder struct cexp2 to save 8 bytes with 64-bit compilation. It is safest to recompile the entire library. solver2.tgz: fix a typo in asl.h and fg_write.c. 20170628 pfg_read.c, pfghread.c: fix a bug (introduced 20170623) that caused wrong derivatives to be computed with certain uses of defined variables. The bug did not appear in solvers2.tgz. 20170629 pfg_read.c, pfghread.c: fix a bug (introduced 20170619) that caused wrong derivatives to be computed with certain uses of defined variables. The bug did not appear in solvers2.tgz. 20170722 mpec_adj.c: fix a bug with ASL_cc_simplify (in the flags argument to .nl readers) that bit on problems with integer (or binary) variables. 20170723: asl.h in solvers2.tgz: add field void* dbuginfo to struct EvalWorkspace. 20170801 solvers2.tgz: fix a bug in pfgh_read() with computing first derivatives for the abs() function. The bug only bit for negative arguments. 20170802 solvers2.tgz: fix a bug with fg_read()'s handling of the example var x; minimize o: if x < 3 then 3 else if x > 6 then 6 else x; and (for debugging) add field stats to EvalWorkspace for accumulating various evaluation counts. 20170803 solvers2.tgz: fix a glitch with obj_adj() (for the "objrep" keyword in various solvers) that could bite when the constraint defining the objective is the last constraint. 20170809 solvers2.tgz: fix a glitch in obj_adj.c that could cause a fault. 20170831 solvers2.tgz: degree.c: fix some bugs with use of reader pfgh_read(). *qpcheck*.c: allow use with reader pfgh_read(). 20170925 printf.c: have printf format %q quote ".". 20171006 The *qpcheck*.c change of 20170831 made it to solvers2 but not solvers; fixed. 20171011 readsol.c: new variant fread_sol_ASL of read_sol_ASL with signature char* fread_sol_ASL(ASL*, const char *fname, real**xp, real **yp); which adds argument fname to specify the full name of the ".sol" file to read. (This name need not end in ".sol".) This is used in today's updated solvers/examples/et.c, via a corresponding new #define of fread_sol() in asl.h. 20171107 mqpcheckv.c, nqpcheck.c in solvers2.tgz: fix bugs with ASL_read_pfgh when "new" linear defined variables are introduced while finding partially separable structure. Updates only to solvers2.tgz. 20171113 mqpcheckv.c, nqpcheck.c in solvers2.tgz: fix a bug with ASL_read_pfgh when squared terms are scaled. Updates only to solvers2.tgz. 20171129 nl_obj.c in solvers2.tgz: fix a bug with objectives of the form "minimize foo: v;" where v is a defined variable. On such objectives, nl_obj(...) returned 0. This affected, e.g., minos and snopt on unconstrained problems. 20171202 asl.h, jac0dim.c, sphes.c, mqpcheck.c, nqpcheck.c: add and use cells nlc0 and nlo0 for the number of nonlinear constraints and objectives before adjustments due to reader flags ASL_obj_replace_eq and ASL_obj_replace_ineq. The whole library should be recompiled. This fixes possible trouble with Hessian computations and qpcheck calls when ASL_obj_replace_eq or ASL_obj_replace_ineq causes problem adjustments. 20171211 mqpcheckv.c: fix a memory leak in mqpcheckv_free_ASL() and a possible fault (or worse) with defined variables. 20171215 mqpcheckv.c, nqpcheck.c: fix some possible trouble with defined variables. 20171218 mqpcheckv.c: fix a possible fault. 20180121 degree.c in solvers2.tgz: fix a bug that could bite degree_ASL() after sos_add() or modifications due to the ASL_cc_simplify, ASL_obj_replace_ineq, or ASL_obj_replace_eq bits in the .nl reader flags. The bug only bit on problems with defined variables used only in one constraint or objective. pfghread.c in solvers2.tgz: fix a possible out-of-bounds array assignment. nqpcheck.c: fix a possible memory leak. misc.c: add recognition of bits "8" and "16" of want_xpi0: if bit 8 is set and X0 is NULL (e.g., the "1" bit is on and no primal initial guess appeared in the .nl file), set X0 to a vector of n_var zeros; if bit 16 is set and pi0 is NULL and n_con > 0, set pi0 to a vector of n_con zeros. 20180123 degree.c in solvers2.tgz: fix a bug in the 20180121 update. 20180209 con1ival.c, con2ival.c, con2val.c, conpval.c, conval.c in solvers.tgz and eval2.c in solvers2.tgz: do not set "x0kind |= ASL_have_conval;" in conval() computations until all relevant constraints have been evaluated. Otherwise, after a failed conval() call, a jacval() call could erroneously proceed, possibly leading to a fault on some problems. Now the jacval() call will fail, setting *nerror to 1. 20180220 eval1.c, eval2.c, fg_read.c, pfghread.c in solvers2.tgz: handle OPNOT. 20180302 eval2.c, pshvprod.c, sphes.c in solvers2.tgz: fix rarely seen bugs giving error messages of the form "Bad *o = 159 ..." or "... 127 ...". indic_cons.c in solvers2.tgz: fix a bug with indicator constraints having an "else" clause. pfghread.c in solvers2.tgz: fix a bug with large .nl files. 20180305 indic_cons.c in solvers2.tgz: fix another (rarely seen) bug with indicator constraints. 20180310 eval2.c in solvers2.tgz: fix a bug with Hessian and Hessian-vector computations with non-null ow (objective weight vector) or y arguments: changes to ow or y at the same x were not correctly handled, which led to incorrect Hessians or Hessian-vector products on some problems. 20180312 pfghread.c: fix a glitch that caused objconst(...) always to return 0 when pfgh_read() was used to read the .nl file. This function always returns 0 for nonlinear objective functions. The glitch did not affect the objval() function. 20180314 pfghread.c, pshvprod.c in solvers2.tgz: fix a bug that gave error message "bad *o = ... in heswork". 20180402 pfghread.c in solvers2.tgz: fix a bug with nonlinear "if" expressions. Wrong derivatives were sometimes possible. 20180411 dtoa.c: fix glitches (compile errors) with compilation under -DSudden_Underflow, which should not be used with ASL; asldate.c not changed. 20180421 indic_cons.c in solvers2.tgz: fix bugs that could cause some indicator constraints to be rejected. 20180430 mqpcheckv.c in solvers.tgz (but not solvers2.tgz): fix a bug with defined variables used in just one objective or constraint. 20180503 fg_read.c in solvers2.tgz: fix a bug (wrong derivatives) with some uses of defined variables. 20180519 rops, rops2.c and eval1.c, eval2.c in solvers2.tgz: compute tanh(x) for large x without complaint. 20180522 degree.c, eval2.c, pfghread.c, pshvprod.c, sphes.c in solvers2.tgz: fix bugs (possible faults) in handling in handling split defined variables and imported functions. 20180525 rops, rops2.c in solvers.tgz and eval1.c, eval2.c in solvers2.tgz: compute tanh(x) for large |x| without complaint. 20180528 pfg_read.s, pfghread.c in solvers.tgz: initialize two fields for use with bogus .nl files (e.g., written by pyomo). sphes.c in solvers.tgz: test for f_OPNUM in nonlinear "if" expressions in hv_fwd (as is done many other places). This quiets a valgrind complaint. 20180609 mqpcheckv.c, nqpcheck.c, sphes.c in solvers2.tgz: fix faults seen in an example with option presolve 0 (a bad idea) when ASL_alloc(ASL_read_pfgh) is used. 20180624 printf.c: honor field widths accompanying %c conversions. They were previously quietly ignored. 20180709 indic_cons.c in solvers2.tgz: fix a bug with defined variables used in indicator constraints. The bug caused a fault with the example behind this fix. 20180816 degree.c, mqpcheckv.c in solvers2.tgz: fix bugs in chaining code blocks. The bugs could have caused some quadratic forms in large .nl files to be treated as general nonlinear expressions. 20181012 README: add a note about bypassing a compiler bug in Microsoft Visual Studion 2017. 20181031 fpinit.c: add #ifdef __ARM_ARCH lines. Should be invisible on non-ARM systems. No change to asldate.c. 20181129 pfg_read.c and pfghread.c in solvers.tgz, pfghread.c in solvers2.tgz: tweak to bypass a valgrind bug. No visible change to observed behavior. 20181210 pfghread.c in solvers2.tgz: fix a bug that might bite with "and" and "or" operators under 64-bit addressing. 20181221 eval2.c, ewalloc2.c, pfghread.c, psinfo.h in solvers2.tgz: fix trouble occasionally seen with imported functions under reader pfgh_read(). The entire library should be recompiled. 20181222 makefile.u, makefile.vc in solvers2.tgz: update dependency rules. No change to asldate.c. 20190225 eval2.c in solvers2.tgz: fix a bug in evaluating piecewise-linear terms when the .nl file is generated with "option pl_linearize 0;". This only matters with reader pfgh_read(). 20190314 obj_adj.c: fix bugs when several objectives can be adjusted. 20190315 pfghread.c in solvers2.tgz: fix a bug that occasionally affected sparsity computations. 20190522 indic_cons.c in solvers2.tgz: fix a bug that caused a diagnosis of "not an indicator constraint" when irrelevant defined variables were nonlinear. 20190605 New file arith.h1. On many systems, it may suffice to use arith.h1 as arith.h (by copying or linking arith.h1 to arith.h). mach.c, stderr.c: add simple tests of whether the ASL was compiled with the right arith.h, assuming IEEE arithmetic. The tests can pass with the wrong arith.h without preventing faults if, e.g., Double_Align needed to be #defined in arith.h. It is best to "make clean; make" in the solvers directory after changing compiler options or compilers for compiling the ASL. People using cross-compilers must take suitable care to get arith.h right, ideally using an arith.h derived on the target system, with the target compiler options and compiler, though using arith.h1 as arith.h may often work. 20190611 Correct a comment about AMPLFUNC_STROUT in funcadd.h; asldate.c not changed. 20190702 arith.h1: add conditional specification of "Long". No change to asldate.c. 20190815 indic_cons.c in solvers2.tgz: fix a bug (e.g., fault) in detecting some invalid indicator constraints. 20191219 solvers2.tgz: fix a bug in degree.c; degree.c eval1.c eval2.c fg_read.c fg_write.c indic_cons.c mqpcheckv.c nqpcheck.c opno.hd opno2.h pfghread.c pshvprod.c sphes.c: new cases in opno.hd and opno2.h in part for forthcoming new source file nl1vcount.c. 20200404 solvers2.tgz: fix some bugs in pfghread.c and pshvprod.c with Hessian computations. The bugs caused "bad opnumber" messages. Remove machlc from makefile.u. 20200413 solvers2.tgz: fix bugs (missing cases) in degree.c, fg_write.c, and indic_cons.c. 20200831 solvers2.tgz: fix another bug (missing cases) in degree.c. 20200928 solvers2.tgz: fix a bug (missing case) in sphes.c. 20201018 solvers2.tgz: eval1.c, eval2.c: fix bugs in handling seldom-seen iterated "and" and "or" operations; eval2.c: fix a glitch with error handling with const^x and add cases OP_atan201_g and OP_atan210_g; pfghread.c: fix a bug in qwalk() with OPCPOW; pshvprod.c: add a missing case and fix a glitches with OPDIV2 and nOPLESS2; remove need for source file op_typeb.hd; opno2.h: add OP_atan201_g and OP_atan210_g; fix bugs in var^var and atan2(var,var). 20201021 solvers2.tgz: pfghread.c: Fix a glitch (incorrectly changed factor), introduced 20201018, with Hessians involving quotients with variables in both numerator and denominator. I made many little test programs for 20201018, but the one for quotients turned out to have zero multiplied by the wrong factor, so it did not reveal the trouble. I've added a test where the quantity in question is nonzero. 20201022 solvers2.tgz: pfghread.c: Fix another glitch (wrong opcode), introduced 20201018, with a constant raised to a variable power. I failed to notice a wrong objective value in the little test of const^variable. 20201029 New variants duthese(), duthese_ew(), fullhese(), fullhese_ew(), hvcompe(), hvcompe_ew(), sphese() and sphese_ew() of duthes(), duthes_ew(), fullhes(), fullhes_ew(), hvcomp(), hvcomp_ew(), sphes() and sphes_ew() that have an extra argument, fint *nerror, that is similar to the nerror argument of other routines, such as objval(): if nerror is null or negative, the new routines return after an error (with *nerror = 1 if nerror is not null); if all goes well and nerror is not null, they return with *nerror = 0. Errors are possible if the function and its first derivative can be computed, but second derivatives fail, as with x^1.5 for x == 0. The new routines appear both in solvers.tgz and in solvers2.tgz. solvers2.tgz: pfghread.c: fix a glitch with atan2: the cases for atan2(const,varexpr) and atan2(varexpr,const) were interchanged. 20201030 solvers.tgz: pshvprod.c: supply a missing return statement to hvpcompse_ASL(). solvers.tgz and solvers2.tgz: export report_where again: yesterday it became file static in repwhere.c, but some solvers call it. solvers.tgz: fix a glitch in pfghread.c (assignment for p.Hvcompde). 20201107 solvers.tgz: asl.h fg_read.c fgh_read.c pfg_read.c: add new field nvinc to struct Edaginfo, for use in mqpcheckv.c and nqpcheck.c; mqpcheckv.c and nqpcheck.c: use asl->I.nvinc rather than trying to compute nvinc from values that could have been changed by sos_add(), and use asl->i.n_var0 at one point rather than the possibly changed n_var. The solvers2.tgz versions of mqpcheckv.c and nqpcheck.c work differently and do not use nvinc. 20201113 solvers.tgz: fix a bug in conpval.c that silently crept in during the updates of 20201029. Line 752 should be deriv_errchk_ASL((ASL*)asl, i, 1, 1); but "deriv_errchk_ASL" somehow got removed. This call is for printing an error message when a constraint body but not its derivative can be computed. 20210327 solvers.tgz and solvers2.tgz: mpec_adj.c: fix an obscure bug that could cause a fault on some complementarity problems. 20210410 eval2.c, pfghread.c, pshvprod.c, sphes.c: fix some obscure bugs with Hessian computations, such as certain if-then-else expressions. 20210613 indic_cons.c (for function indicator_constrs_ASL): in solvers.tgz, flx a possible fault and provide a missing nvinc adjustment for defined variables; in solvers2.tgz, add missing code for defined variables used in just one constraint. 20210819 mqcheckv.c in both solvers.tgz and solvers2.tgz: fix a bug involving a defined variable that references another defined variable and that is shared by two or more objectives or constraints. In the example that exposed the bug, the solver faulted. 20210924 mqpcheckv.c and nqpcheck.c in both solvers.tgz and solvers2.tgz: fix a rarely seen bug (fault) arising when cancellation cause a term to completely vanish. 20211001 getstub.c in both solvers.tgz and solvers2.tgz: arrange for ", liccheck(yyyymmdd)" to appear in the output produced by show_version_ASL(oi) when getstub.c is compiled with -DLICCHECKVERSION=yyyymmdd . 20211029 readsol.c in both solvers.tgz and solvers2.tgz: fix a bug with binary .sol files and no constraints. 20211109 func_add.c in both solvers.tgz and solvers2.tgz: quietly ignore inappropriate addfunc_ASL calls unless compiled with -DCOMPLAIN_AT_BAD_FTYPE. This allows AMPL and solvers to use a .dll that includes some functions that can only be used in an AMPL session -- the solvers quietly ignore them. 20220520 Quietly reduce absurdly large precisions in printf formats. For example, "%.410g" faulted. Now it works and "%.500g" is quietly reduced to "%.415g". Fix a small performance bug in misc.c -- only need to invoke zerograd_chk once. 20221103 mqpcheckv.c, nqpcheck.c in both solvers.tgz and solvers2.tgz: fix a fault that arose under when there are rare cancellations. Example: var x >= 1; var u; var w; minimize o: (w + (1 - w))*(x - u) + u; # really just x 20221115 misc.c in both solvers.tgz and solvers2.tgz: recant change of 20220520, which had removed a sometimes needed call. 20230310 fgh_read.c: a tweak that only matters to pedants. suf_sos.c: adjust nranges (= asl->i.nranges_) when SOS2 constraints are handled. 20230328 pfghread.c in solvers2.tgz: fix a bug in computing derivatives of piecewise-linear terms. pshvprod.c in solvers2.tgz: fix a bug in computing Hessians involving piecewise-linear terms. 20230330 jac0dim.c: change return_nofile (= asl->i.return_nofile_) so (return_nofile & 1) works as before and (return_nofile & 2) causes a quiet return of 0 when the given file does not have a valid .nl header (the first 10 lines). The default return_nofile is still 0. 20230818 solvers2.tgz: fix an error-message glitch in fg_write.c; omit source file jac2dim.c. 20231111 solvers.tgz: minor tweaks that should not affect results. solvers2.tgz: minor tweaks as in solvers.tgz, plus a bug fix to pfghread.c that affected Hessians of imported functions having several arguments involving variables. 20240106 solvers2.tgz: fix a bug with constant terms that seemingly involve variables, such as (v-v)^2; the terms were ignored instead of contributing to the objective or constraint in which they appeared, which mattered when the terms were nonzero, such as cos(v-v)^2.