1This directory contains source for a library of routines that help 2solvers work with AMPL. In this README file, the library is called 3amplsolver.a (the name it usually has on Unix systems), but on some 4systems it may have another name, such as amplsolver.so or (on 5Microsoft systems) amplsolv.lib. Services provided by amplsolver.a 6include reading AMPL's generic output (.nl) files, and writing 7solution (.sol) files. Subdirectories (e.g., cplex, examples, minos) 8contain interface routines for particular solvers; you may wish to 9modify these routines to make your own solver work with AMPL. 10 11To make an executable version of a particular solver, you need 12at least this directory and the solver's subdirectory. You need 13to invoke "make" once in this directory to create amplsolver.a, 14and then invoke "make" in each solver subdirectory of interest. 15The exact form of the "make" command depends on the system you 16are using. There is more discussion about "make" and makefiles 17below. 18 19Some installations have several kinds of computers, with various 20hardware and operating systems, and with cross-mounted file systems 21visible from the various computers. On such systems, the "configure" 22script may be helpful. It arranges to compile amplsolver.a in 23system-specific subdirectories with names that, unless otherwise 24specified, begin with "sys." and by default are determined by the 25Bourne-shell syntax 26 27 sys.`uname -m`.`uname -s` 28 29Invoking 30 31 ./configure 32 33creates a sys.* directory for the current system and adds a 34generic makefile, such that invoking "make" will give the 35same result as 36 37 cd sys.`uname -m`.`uname -s` 38 make 39 40(creating amplsolver.a in the system-specific subdirectory). 41 42Alternatively, if you deal with only one kind of hardware and 43Unix- or Linux-like operating system (including Cygwin or MinGW/MSYS 44under MS Windows), you could invoke 45 46 ./configurehere 47 48to arrange for compiling amplsolver.a in this directory. Either 49way (after "./configure" or "./configurehere") you invoke "make" 50to compile amplsolver.a 51 52 53To get all the source files for amplsolver.a by E-mail, send netlib 54(e.g., netlib@netlib.org) the request 55 56 send all from ampl/solvers 57 58You can also get a tar file of ampl/solvers and all its subdirectories 59with a web browser, by clicking on "tar" in the line "lib: models (tar)" in 60 61 http://netlib.sandia.gov/ampl/ 62 63The file you download will be called netlibfiles.tar; executing 64 65 tar xf netlibfiles.tar 66 67will give you directory ampl/solvers containing gzipped files and 68subdirectories; the next step will be 69 70 cd ampl/solvers 71 gzip -dN *.gz 72 73to uncompress the .gz files. (Do this also in any subdirectories 74of interest.) 75 76Beware that some older versions of Netscape and Internet Explorer 77mishandle "http:" URLs that end in ".gz". 78 79See the comments about tar and .gz files in /netlib/bib/compression.html 80(e.g., http://netlib.sandia.gov/bib/compression.html or 81http://www.netlib.org/bib/compression.html). 82 83For more about AMPL itself, see the AMPL book (second edition): 84 85 "AMPL: A Modeling Language for Mathematical Programming" 86 by Robert M. Fourer, David M. Gay, and Brian W. Kernighan; 87 Duxbury Press / Brooks/Cole Publishing Company, 2002; 88 ISBN 0-534-38809-4 89 90See the pointers to book vendors in 91 92 http://www.ampl.com/BOOK/ 93 94 95For solvers written in Fortran, we assume the f2c calling 96conventions. Source for f2c (Fortran-to-C converter) is 97available by E-mail from netlib@netlib.org and anonymous 98ftp from netlib.bell-labs.com; for details, send the E-mail message 99 100 send index from f2c 101 102to netlib@netlib.org . 103 104See README.f77 for a summary of adjustments that permit use of the 105native Fortran 77 compilers on some systems. 106 107For machines with IBM mainframe arithmetic (i.e., the arithmetic 108of the IBM 360 and 370 series and their successors and imitators, 109such as Amdahl), use arith.ibm as arith.h and add rnd_prod.s to 110the end of the "a =" assignment in the makefile. For other systems, 111let the makefile compile and execute arithchk.c to create a 112suitable arith.h. Do not copy arith.h from one kind of computer 113to another. 114 115See the comments in "makefile" about compiling on non-ANSI systems, 116which may require compiling with -DKR_headers, saying "make float.h", 117adding strerror.c to the makefile's "a =" assignment, etc. Also see 118the comments in "makefile" about compiling on particular systems. 119 120 121Various subdirectories are available, including the following. They 122provide sample AMPL interfaces, but do not include source or objects 123for the solvers themselves (which you must get from the relevant 124solver vendor, noted in the README.1st file in each subdirectory). 125For more details about, say, MINOS, send the E-mail message 126 send readme from ampl/solvers/minos 127to netlib@netlib.org . 128 129 Subdirectory Comments 130 131 bpmpd Research interior LP code by Cs. Meszaros. 132 133 cplex Uses CPLEX Corp.'s solver: linear (simplex and 134 interior algorithms), network, quadratic, and MIP 135 problems. 136 137 donlp2 General nonlinear optimizer by Peter Spellucci. 138 Uses an SQP algorithm and dense linear algebra. 139 140 examples Source for examples in "Hooking Your Solver to AMPL". 141 142 fsqp Based on CFSQP, a nonlinear solver by Craig Lawrence, 143 Jian L. Zhou, and Andre L. Tits. 144 145 funclink Examples and system-specific makefiles for making 146 shared libraries (.dll files) of imported (i.e., 147 user-defined) functions. 148 149 lancelot Based on LANCELOT (by A. R. Conn, Nick Gould, and 150 Ph. L. Toint): general nonlinear programming code 151 using sparse linear algebra. 152 153 loqo Interior code by Robert Vanderbei: for linear and 154 convex quadratic (or convex nonlinear) problems. 155 156 lpsolve Simplex and MIP solver based on lp_solve by 157 Michel Berkelaar (michel@es.ele.tue.nl). 158 159 minos Uses Murtagh & Saunders's code for nonlinear problems; 160 reduces to simplex on linear problems. 161 162 nlc Source for "nlc" program, which emits Fortran or C 163 for computing objectives, constraint bodies, and 164 their gradients. 165 166 npopt New version of npsol (see below), available from 167 Philip Gill to people who have npsol. 168 169 npsol Based on NPSOL (by Gill, Murray, Saunders, Wright), 170 a sequential quadratic programming code for solving 171 nonlinear programming problems. 172 173 path Based on the PATH solver of Prof. Michael C. Ferris 174 and his former students Steven P. Dirkse and Todd S. 175 Munson, for solving "square" nonlinear 176 complementarity problems. 177 178 snopt Sparse nonlinear solver by Philip Gill et al., 179 available from him to people who have npsol. 180 181 xpress Based on XPRESS-MP, a solver for linear and 182 quadratic programming problems involving continuous 183 or integer variables by Dash Optimization, 184 http://www.dashoptimization.com/ 185 186For information about arranging to use other solvers with AMPL, 187see "Hooking Your Solver to AMPL", Postscript for which is 188 189 ftp://www.ampl.com/REFS/hooking.ps.gz 190 http://www.ampl.com/REFS/hooking.ps.gz 191 192and a corresponding html version is 193 194 http://www.ampl.com/REFS/HOOKING/ 195 196Be sure to request the changes file periodically to see about bug fixes 197and other updates, or send the 2-word E-mail message 198 199 subscribe ampl 200 201to netlib@netlib.org to receive notification of updates. 202Please send bug reports and other comments to dmg@ampl.com 203(David M. Gay). 204 205 206This directory contains several makefile variants with names of the 207form makefile.*; makefile.u is for Unix systems, and the others are 208for various PC compilers. Comments in makefile.u describe adaptions 209for particular Unix systems. The PC variants start (after legal 210disclaimers) with comments saying what compiler they are for and 211telling what "make" incantation to use. The "examples" subdirectory 212and a few others have analogous makefile variants are obtained from 213makefile.u by changing ".o" to ".obj" and suitably adjusting the rules 214for compiling, linking, and making libraries. 215 216The PC makefiles create "amplsolv.lib" and are set up for Win32; 217some of the PC makefiles have comments explaining changes for MS-DOS. 218If you are using Microsoft Visual C++, see the comments in makefile.vc 219about linking solvers. 220 221The PC makefiles require you to make details.c by hand (since deriving 222it automatically seems hard to do reliably). It should reflect the 223compiler you are using. For example, for Microsoft Visual C++ 6.0, 224having details.c consist of the single line 225 char sysdetails_ASL[] = "MS VC++ 6.0"; 226would be appropriate. For systems other than Intel IA32 systems 227(e.g., for IA64 or DEC Alpha systems), the system should also be 228indicated in sysdetails_ASL. This string is used by some solvers 229as part of the output produced for the "version" keyword and the -v 230command-line option. 231 232Formerly it was necessary to check by hand whether your math library 233sometimes returns NaNs without setting errno when math functions are 234called with invalid arguments, and if so to add -DNANCHECK to the 235CFLAGS assignment of the relevant makefile variant. Now this detail 236should be handled by a #define in arith.h, which should be computed 237automatically as described above. If you know that your math library 238never sets errno, adding -DNO_ERRNO to the relevant CFLAGS assignment 239will save a little time and perhaps avoid compiler complaints. 240 241When linking nonlinear solvers on some systems, it's necessary to 242add system-dependent keywords to the linking command, e.g., to make 243dlopen() visible. Some of the makefiles for specific solvers have 244comments about this, and subdirectory funclink contains sample 245makefiles that illustrate how to do things on for several popular 246systems. 247 248In general, it is necessary once in this directory to give the 249appropriate "make" invocation, such as 250 251 make 252 253on Unix platforms, 254 255 nmake -f makefile.vc 256 257under Windows NT or W9x with MS Visual C++, etc., and then to give 258a suitable "make" invocation in each solver subdirectory of interest. 259On non-Unix systems, in many of the solver subdirectories it may be 260necessary to modify the Unix makefile into the form required by the 261system. 262