home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / answers / linear-programming-faq < prev    next >
Encoding:
Text File  |  1993-06-01  |  44.5 KB  |  856 lines

  1. Newsgroups: news.answers,sci.answers,sci.math.num-analysis
  2. Path: senator-bedfellow.mit.edu!enterpoop.mit.edu!gatech!howland.reston.ans.net!math.ohio-state.edu!cs.utexas.edu!uunet!timbuk.cray.com!walter.cray.com!jwg
  3. From: jwg@cray.com (John W. Gregory)
  4. Subject: Linear Programming FAQ
  5. Message-ID: <linear-programming-faq-1-738951133@cray.com>
  6. Followup-To: sci.math.num-analysis
  7. Summary: A List of Frequently Asked Questions about Linear Programming
  8. Originator: jwg@ceres
  9. Keywords: FAQ, LP, Linear Programming
  10. Lines: 837
  11. Nntp-Posting-Host: ceres.cray.com
  12. Reply-To: jwg@cray.com (John W. Gregory)
  13. Organization: Cray Research, Inc., Eagan MN USA
  14. Date: 1 Jun 93 11:12:27 CDT
  15. Approved: news-answers-request@MIT.Edu
  16. Expires: 08/05/93
  17. Xref: senator-bedfellow.mit.edu news.answers:8965 sci.answers:230 sci.math.num-analysis:8427
  18.  
  19. Posted-By: auto-faq 2.4
  20. Archive-name: linear-programming-faq
  21. Last-modified: June 1, 1993
  22.  
  23.  
  24.            Linear Programming - Frequently Asked Questions List
  25.                          (linear-programming-faq)
  26.                    Most recent update: June 1, 1993
  27.  
  28. --------------------------------------------------------------------------
  29.  
  30. 0.  "What's in this FAQ?"
  31.  
  32. A:  Table of Contents
  33.     1.  "What is Linear Programming?"
  34.     2.  "Where is there a good code, preferably public domain, to solve
  35.          Linear Programming problems?"
  36.     3.  "Oh, and we also want to solve it as an integer program. I think
  37.          there will be only a few thousand variables or so."
  38.     4.  "I've written my own optimization code.  Where are some test models?"
  39.     5.  "What is MPS format?"
  40.     6.  "What software is there for nonlinear optimization?"
  41.     7.  "Just a quick question..."
  42.     8.  "What references are there in this field?"
  43.     9.  "Who maintains this FAQ list?"
  44.  
  45. --------------------------------------------------------------------------
  46.  
  47. 1.  "What is Linear Programming?"
  48.  
  49. A:  A Linear Program (LP) is a problem that can be put into the form
  50.  
  51.     minimize   cx
  52.     subject to Ax=b
  53.                 x>=0
  54.  
  55. where x is a vector to be solved for, A is a matrix of known coefficients,
  56. and c and b are vectors  of known coefficients.  All these entities must 
  57. have consistent dimensions, of course, and you can add "transpose" symbols
  58. to taste.  The matrix A is generally not square, hence you don't solve an
  59. LP by just inverting A.  Usually A has more columns than rows, so  Ax=b
  60. is therefore underdetermined, leaving great latitude in the choice of x 
  61. with which to minimize cx.
  62.  
  63. Other formulations can be used in this framework.  For instance, if you 
  64. want to maximize instead of minimize, multiply the c vector by -1.  If 
  65. you have constraints that are inequalities rather than equations, you 
  66. can introduce one new variable (a "slack") for each inequality and treat 
  67. the augmented row of the matrix as an equation.  LP codes will usually
  68. take care of such "bookkeeping" for you.
  69.  
  70. LP problems are usually solved by a technique known as the Simplex Method, 
  71. developed in the 1940's and after.  Briefly stated, this method works by 
  72. taking a sequence of square submatrices of A and solving for x, in such a 
  73. way that successive solutions always improve, until a point is reached 
  74. where improvement is no longer possible.  A family of LP algorithms known 
  75. as Interior Point methods has been developed starting in the 1980's, that 
  76. can be faster for many (but so far not all) problems.  Such methods are
  77. characterized by constructing a sequence of trial solutions that go 
  78. through the interior of the solution space, in contrast to the Simplex
  79. Method which stays on the boundary and examines only the corners (vertices).
  80.  
  81. LP has a variety of uses, in such areas as petroleum, finance, transportation, 
  82. forestry, and military.
  83.  
  84. The word "Programming" is used here in the sense of "planning"; the
  85. necessary relationship to computer programming was incidental to the 
  86. choice of name.  Hence the phrase "LP program" to refer to a piece of 
  87. software is not a redundancy, although I tend to use the term "code" 
  88. instead of "program" to avoid the possible ambiguity.
  89.  
  90. --------------------------------------------------------------------------
  91.  
  92. 2.  "Where is there a good code, preferably public domain, to solve 
  93. Linear Programming problems?"
  94.  
  95. A:  It depends on the size and difficulty of your models.  LP technology 
  96. and computer technology have both made such great leaps that models that 
  97. were previously considered "large" are now routinely solved.  Nowadays, 
  98. with good commercial software (i.e., code that you pay for), models with 
  99. a few thousand constraints and several thousand variables can be tackled 
  100. with a PC.  Workstations can often handle models with variables in the 
  101. tens of thousands, or even greater, and mainframes can go larger still.
  102. Public domain codes can be relied on to solve models of smaller dimension.
  103. The choice of the code can make more difference than the choice of computer 
  104. hardware.  It's hard to be specific about model sizes and speed, a priori, 
  105. due to the wide variation in things like model structure and variation in 
  106. factorizing the basis matrices.
  107.  
  108. There is a recently released public domain code, written in C, called 
  109. "lp_solve" that is available on Usenet in the "comp.sources.reviewed" 
  110. newsgroup.  Its author (Michel Berkelaar, email at  michel@es.ele.tue.nl ) 
  111. claims to have solved models with up to 30,000 variables and 50,000 
  112. constraints.  My own experience with this code is not quite so uniformly 
  113. optimistic (new users of LP are sometimes shocked to learn that just
  114. because a given code has solved a model of a certain dimension, it may not
  115. be able to solve all models of the same size).  Still, for someone who 
  116. isn't sure just what kind of LP code is needed, it represents a very 
  117. reasonable first try, and the price is certainly right.  The code is 
  118. archived at anonymous ftp site "ftp.uu.net", in directory 
  119.     "/usenet/comp.sources.reviewed/volume02/lp_solve".
  120. This directory consists of three files, part00.Z, part01.Z and part02.Z.  
  121. You should download them in binary mode, and use the `uncompress` utility 
  122. to expand them to normal ASCII format.  The file called part00 contains 
  123. reviewers' comments, and the other two files can be unpacked by removing 
  124. the first 9 lines and executing the files as shell scripts (for example, 
  125. `sh part01`).  Then follow the instructions in the README and INSTALL 
  126. files.
  127.  
  128. For DOS/PC users, Prof. Timo Salmi at the University of Vaasa in Finland 
  129. offers a Linear Programming and Linear Goal Programming binary called 
  130. "tslin".  You should be able to access it by ftp at garbo.uwasa.fi in 
  131. directory /pc/ts (the current file name is tslin33b.zip, apparently 
  132. using ZIP compression), or else I suggest contacting Prof. Salmi at
  133. ts@uwasa.fi .
  134.  
  135. The consensus is that the LP code published in Numerical Recipes is not at 
  136. all strong, and should be avoided for heavy-duty use.  If your requirement 
  137. is for a solver that can handle 100-variable models, it might be okay.
  138.  
  139. There is an ACM TOMS routine for LP, #552, available from the netlib server,
  140. in directory /netlib/toms.  See the section on test models for detail on 
  141. how to use this server.
  142.  
  143. If you have access to one of the commercial math libraries, such as IMSL or 
  144. NAG, you may be able to use an LP routine from there.
  145.  
  146. There are books that contain source code for the simplex method.
  147. John Chinneck has brought to my attention:
  148. - Best and Ritter, Linear Programming: active set analysis and computer 
  149. programs, Prentice-Hall, 1985.
  150. - Bunday and Garside, Linear Programming in Pascal, Edward Arnold 
  151. Publishers, 1987.
  152. - Bunday, Linear Programming in Basic (presumably the same publisher).
  153.  
  154. If your models prove to be too difficult for free software to handle, 
  155. then you can consider acquiring a commercial LP code.  There are dozens 
  156. of such codes on the market. I have my own opinions, but for reasons of 
  157. space, generality and fairness, I will not attempt even to list the codes 
  158. I know of here.  Instead I refer you to the annual survey of LP software 
  159. published in "OR/MS Today", a joint publication of ORSA (Operations 
  160. Research Society of America) and TIMS (The Institute of Management 
  161. Science).  I think it's likely that you can find a copy of the June, 1992 
  162. issue, either through a library, or by contacting a member of these two 
  163. organizations (most universities probably have several members among the 
  164. faculty and student body).  The survey lists almost fifty actively marketed 
  165. products.  This publication also carries advertisements for many of these 
  166. products, which may give you additional information to help make a decision.
  167.  
  168. There are many considerations in selecting an LP code.  Speed is important, 
  169. but LP is complex enough that different codes go faster on different models; 
  170. you won't find a "Consumer Reports" article  8v)  to say with certainty which 
  171. code is THE fastest.  I usually suggest getting benchmark results for your 
  172. particular type of model if speed is paramount to you.  Benchmarking may 
  173. also help determine whether a given code has sufficient numerical stability 
  174. for your kind of models.
  175.  
  176. Other questions you should answer: Can you use a stand-alone code, or do 
  177. you need a code that can be used as a callable library, or do you require 
  178. source code?  Do you want the flexibility of a code that runs on many 
  179. platforms and/or operating systems, or do you want code that's tuned to 
  180. your particular hardware architecture (in which case your hardware vendor 
  181. may have suggestions)?  Is the choice of algorithm (Simplex, Interior 
  182. Point) important to you?  Do you need an interface to a spreadsheet 
  183. code?  Is the purchase price an overriding concern?  Is the software 
  184. offered at an academic discount (assuming you are at a university)?  How 
  185. much hotline support do you think you'll need?
  186.  
  187. It may not always be true that "you get what you pay for," but it is rare 
  188. that you get more than you pay for.  8v)   There is usually a large 
  189. difference in LP codes, in performance (speed, numerical stability, 
  190. adaptability to computer architectures) and features, as you climb the 
  191. price scale.  If a code seems overpriced to you, you may not yet 
  192. understand all of its features.
  193.  
  194. --------------------------------------------------------------------------
  195.  
  196. 3.  "Oh, and we also want to solve it as an integer program. I think
  197. there will be only a few thousand variables or so."
  198.  
  199. A:  Hmmmm.  You want
  200.     - Nontrivial model size
  201.     - Integer solutions
  202.     - Public domain code
  203. Pick one or maybe two of the above.  You can't have all three.  8v)
  204.  
  205. Integer LP models are ones where the answers must not take fractional 
  206. values.  It may not be obvious that this is a VERY much harder problem 
  207. than ordinary LP, but it is nonetheless true.  The buzzword is "NP-
  208. Completeness", the definition of which is beyond the scope of this 
  209. document but means in essence that, in the worst case, the amount of 
  210. time to solve a family of related problems goes up exponentially as the 
  211. size of the problem grows, for all known algorithms that solve such 
  212. problems to a proven answer. 
  213.  
  214. Integer models may be ones where only some of the variables are to be 
  215. integer and others may be real-valued (termed "Mixed Integer LP" or 
  216. MILP, or "Mixed Integer Programming" or MIP); or they may be ones where 
  217. all the variables must be integral (termed "Integer LP" or ILP).  The 
  218. class of ILP is often further subdivided into problems where the only 
  219. legal values are {0,1} ("Binary" or "Zero-One" ILP), and general integer 
  220. problems.  For the sake of generality, the Integer LP problem will be 
  221. referred to here as MIP, since the other classes can be viewed as special 
  222. cases of MIP.
  223.  
  224. You should be prepared to solve far smaller MIP models than the 
  225. corresponding LP model, given a certain amount of time you wish to 
  226. allow (unless you and your model happen to be very lucky). There exist 
  227. models that are considered challenging, with mere hundreds of variables. 
  228. Conversely, some models with tens of thousands of variables solve 
  229. readily.  It all depends, and the best explanations of "why" always
  230. seem to happen after the fact.  8v)
  231.  
  232. A major exception to this gloomy outlook is that there are certain models
  233. whose LP solution always turns out to be integer.  Best known of these
  234. are the so-called Transportation Problem, Assignment Problem, and
  235. Network-Flow Problem.  The theory of unimodular matrices is fundamental
  236. here.  It turns out that these particular problems are best solved by 
  237. specialized routines that take major shortcuts in the Simplex Method, 
  238. and as a result are relatively quick running even compared to ordinary
  239. LP.  See the section on references for a book by Kennington and Helgason, 
  240. which contains some source code for Netflo.  Netflo is available by 
  241. anonymous ftp at dimacs.rutgers.edu, in directory 
  242.     /pub/netflow/mincost/solver-1
  243. but I don't know the copyright situation (I thought you had to buy the 
  244. book to get the code).  Some commercial LP solvers also include a
  245. network solver.
  246.  
  247. People are sometimes surprised to learn that MIP problems are solved 
  248. using floating point arithmetic.  Although various algorithms for MIP 
  249. have been studied, most if not all available general purpose large-scale 
  250. LP codes use a method called "Branch and Bound" to try to find an optimal 
  251. solution.  Briefly stated, B&B solves MIP by solving a sequence of related 
  252. LP models.  Good codes for MIP distinguish themselves more by solving 
  253. shorter sequences of LP's, than by solving the individual LP's faster.  
  254. Even more so than with regular LP, a costly commercial code may prove 
  255. its value to you if your MIP model is difficult.
  256.  
  257. As a point of interest, the Simplex Method currently retains an advantage 
  258. over the newer Interior Point methods for solving these sequences of LP's.
  259.  
  260. The public domain code "lp_solve", mentioned earlier, accepts MIP models,
  261. as do a large proportion of the commercial LP codes in the OR/MS Today 
  262. survey.  I have seen mention made of algorithm 333 in the Collected 
  263. Algorithms from CACM, though I'd be surprised if it was robust enough 
  264. to solve large models.  
  265.  
  266. Mustafa Akgul (AKGUL@TRBILUN.BITNET) at Bilkent University maintains an 
  267. archive via anonymous ftp (firat.bcc.bilkent.edu.tr or 139.179.10.13).  
  268. In addition to a copy of lp_solve (though I would recommend using the
  269. official source listed in the previous section), there is mip386.zip,
  270. which is a zip-compressed code for PC's.  He also has a couple of 
  271. network codes and various other codes he has picked up.  All this is 
  272. in directory pub/IEOR/Opt and its further subdirectories LP, PC, 
  273. and Network.
  274.  
  275. The better commercial MIP codes have numerous parameters and options to 
  276. give the user control over the solution strategy.  Most have the capability 
  277. of stopping before an optimum is proved, printing the best answer obtained 
  278. so far.  For many MIP models, stopping early is a practical necessity. 
  279. Fortunately, a solution that has been proved by the algorithm to be within, 
  280. say, 1% of optimality often turns out to be the true optimum, and the bulk 
  281. of the computation time is spent proving the optimality. For many modeling 
  282. situations, a near-optimal solution is acceptable anyway.
  283.  
  284. Once one accepts that large MIP models are not typically solved to a
  285. proved optimal solution, that opens up a broad area of approximate 
  286. methods, probabilistic methods and heuristics, as well as modifications
  287. to B&B.  Claims have been made for Genetic Algorithms and Simulated 
  288. Annealing, though (IMHO) these successes have been problem dependent 
  289. and difficult to generalize.  Two references for GA are a book by
  290. David Goldberg, "Genetic Algorithms in Search, Optimization, and Machine 
  291. Learning" (Addison-Wesley, 1989), and an article by Michalewicz et al. in 
  292. volume 3(4), 1991 of the ORSA Journal on Computing.  An extensive survey
  293. of GA software is maintained by Nici Schraudolph (nici@cs.ucsd.edu).
  294.  
  295. Whatever the solution method you choose, when trying to solve a difficult 
  296. MIP model, it is usually crucial to understand the workings of the physical 
  297. system (or whatever) you are modeling, and try to find some insight that 
  298. will assist your chosen algorithm to work better.  A related observation 
  299. is that the way you formulate your model can be as important as the actual 
  300. choice of solver.  You should consider getting some assistance if this 
  301. is your first time trying to solve a large (>100 variable) problem.
  302.  
  303. --------------------------------------------------------------------------
  304.  
  305. 4.  "I've written my own optimization code.  Where are some test models?"
  306.  
  307. A:  In light of the comments above, I hope your aims are fairly modest,
  308. for there are already a lot of good codes out there.  I hope your LP 
  309. code makes use of sparse matrix techniques, rather than using a tableau
  310. form of the Simplex method, because the latter usually ends up being
  311. numerically unstable and very slow.
  312.  
  313. If you want to try out your code on some real-world LP models, there is 
  314. a very nice collection of small-to-medium-size ones on netlib.  If you
  315. have ftp access, you can try "ftp research.att.com", using "netlib"
  316. as the Name, and your email address as the Password. Do a "cd lp/data"
  317. and look around. There should be a "readme" file, which you would 
  318. want to look at first.  Alternatively, you can reach an e-mail
  319. server via "netlib@ornl.gov", to which you can send a message saying
  320. "send index from lp/data"; follow the instructions you receive.
  321.  
  322. The Netlib LP files (after you uncompress them) are in a format called 
  323. MPS, which is described in another section of this document.
  324.  
  325. There is a collection of MIP models, housed at Rice University.  Send
  326. an email message containing "send catalog" to  softlib@rice.edu , to get
  327. started.  Or you may be able to do anonymous ftp to softlib.cs.rice.edu,
  328. then "cd /pub/miplib".
  329.  
  330. There is a collection of network-flow codes and models at DIMACS (Rutgers
  331. University).  Use anonymous FTP at dimacs.rutgers.edu.  Start looking in
  332. /pub/netflow.  Another network generator is called NETGEN and is available
  333. on netlib (lp/generators).
  334.  
  335. John Beasley has posted information on his OR-Lib, which contains various
  336. optimization test problems.  Send e-mail to  umtsk99@vaxa.cc.imperial.ac.uk
  337. to get started.  Or have a look in the Journal of the Operational Research
  338. Society, Volume 41, Number 11, Pages 1069-72.
  339.  
  340. There are various test sets for NLP (Non-Linear Programming).  Among
  341. those I've seen mentioned are
  342.   - ACM TOMS (Transactions on Mathematical Software), V13 No3 P272
  343.   - publications (listed in another section of this list) by Schittkowski; 
  344.     Hock & Schittkowski;  Floudas & Pardalos; Torn; Hughes & Grawiog.
  345. Many of the other references also contain various problems that you
  346. could use to test a code.
  347.  
  348. The modeling language GAMS comes with about 100 test models, which
  349. you might be able to test your code with.
  350.  
  351. --------------------------------------------------------------------------
  352.  
  353. 5.  "What is MPS format?"
  354.  
  355. A:  MPS format was named after an early IBM LP product and has emerged 
  356. as a de facto standard ASCII medium among most of the various commercial 
  357. LP codes.  You will need to write your own reader routine for this, but 
  358. it's not too hard. The main things to know about MPS format are that it 
  359. is column oriented (as opposed to entering the model as equations), and 
  360. everything (variables, rows, etc.) gets a name.  MPS format is described 
  361. in more detail in Murtagh's book, referenced in another section.  Here 
  362. is a little sample model, explained in more detail below:
  363.  
  364. NAME          METALS   
  365. ROWS
  366.   N VALUE
  367.   E YIELD
  368.   L FE
  369.   L MN
  370.   L CU
  371.   L MG
  372.   G AL
  373.   L SI
  374. COLUMNS
  375.     BIN1      VALUE       0.03         YIELD           1.
  376.     BIN1      FE          0.15         CU             .03
  377.     BIN1      MN          0.02         MG             .02
  378.     BIN1      AL          0.7          SI             .02
  379.     BIN2      VALUE       0.08         YIELD           1.
  380.     BIN2      FE           .04         CU             .05
  381.     BIN2      MN           .04         MG             .03
  382.     BIN2      AL           .75         SI             .06
  383.     BIN3      VALUE       0.17         YIELD         1.
  384.     BIN3      FE           .02         CU             .08
  385.     BIN3      MN           .01         AL             .8
  386.     BIN3      SI           .08
  387.     BIN4      VALUE       0.12         YIELD         1.
  388.     BIN4      FE           .04         CU             .02
  389.     BIN4      MN           .02         AL             .75
  390.     BIN4      SI          0.12
  391.     BIN5      VALUE       0.15         YIELD         1.
  392.     BIN5      FE           .02         CU             .06
  393.     BIN5      MN           .02         MG             .01
  394.     BIN5      SI           .02         AL             .8
  395.     ALUM      VALUE       0.21         YIELD         1.
  396.     ALUM      FE           .01         CU             .01
  397.     ALUM      AL           .97         SI             .01
  398.     SILCON    VALUE       0.38         YIELD         1.
  399.     SILCON    FE           .03         SI             .97
  400. RHS
  401.     ALOY1     YIELD        2000.       FE              60.
  402.     ALOY1     CU            100.       MN              40.
  403.     ALOY1     MG             30.       AL            1500.
  404.     ALOY1     SI            300.
  405. BOUNDS
  406.  UP PROD1     BIN1            200.00
  407.  UP PROD1     BIN2            750.00
  408.  LO PROD1     BIN3            400.00
  409.  UP PROD1     BIN3            800.00
  410.  LO PROD1     BIN4            100.00
  411.  UP PROD1     BIN4            700.00
  412.  UP PROD1     BIN5           1500.00
  413. ENDATA
  414.  
  415.  
  416. MPS is an old format, so it is set up as though you were using
  417. punch cards, and is not free format. Fields start in column 1,
  418. 5, 15, 25, 40 and 50.  Sections of an MPS file are marked by
  419. so-called header cards, which are distinguished by their starting
  420. in column 1.  Although it is typical to use upper-case throughout
  421. the file (like I said, MPS has long historical roots), many 
  422. MPS-readers will accept mixed-case for anything except the
  423. header cards, and some allow mixed-case anywhere.
  424.  
  425. The NAME card can be anything you want.  The ROWS section defines 
  426. the names of all the constraints; entries in column 2 or 3 are E 
  427. for equality rows, L for less-than ( <= ) rows, G for greater-than  
  428. ( >= ) rows, and N for non-constraining rows (the first of which 
  429. would be interpreted as the objective function).
  430.  
  431. The largest part of the file is in the COLUMNS section, which is 
  432. the place where the entries of the A-matrix are put.  All entries 
  433. for a given column must be placed consecutively, although within 
  434. a column the order of the entries (rows) is irrelevant. Rows not 
  435. mentioned for a column are implied to have a coefficient of zero.
  436.  
  437. The RHS section allows one or more right-hand-side vectors to be 
  438. defined; most people don't bother having more than one.  In the
  439. above example, the name of the RHS vector is ALOY1, and has non-zero 
  440. values in all 7 of the constraint rows of the problem.  Rows not 
  441. mentioned in an RHS vector would be assumed to have a right-hand-side 
  442. of zero.
  443.  
  444. The optional BOUNDS section lets you put lower and upper bounds on 
  445. individual variables (no * wild cards, unfortunately), instead of 
  446. having to define extra rows in the matrix.  All the bounds that have 
  447. a given name in column 5 are taken together as a set.  Variables 
  448. not mentioned in a BOUNDS set are taken to be non-negative.  There 
  449. is another optional section called RANGES that I won't go into 
  450. here. The final card must be the ENDATA, and yes, it is spelled 
  451. funny.
  452.  
  453. For comparison, here is the same model written out in an equation-
  454. oriented format.
  455.  
  456. Minimize
  457.  VALUE: 0.03 BIN1 + 0.08 BIN2 + 0.17 BIN3 + 0.12 BIN4 + 0.15 BIN5 
  458.  + 0.21 ALUM + 0.38 SILCON
  459. Subject To
  460.  YIELD: BIN1 + BIN2 + BIN3 + BIN4 + BIN5 + ALUM + SILCON  = 2000
  461.  FE:    0.15 BIN1 + 0.04 BIN2 + 0.02 BIN3 + 0.04 BIN4 + 0.02 BIN5 
  462.         + 0.01 ALUM + 0.03 SILCON <= 60
  463.  MN:    0.02 BIN1 + 0.04 BIN2 + 0.01 BIN3 + 0.02 BIN4 + 0.02 BIN5 
  464.         <= 40
  465.  CU:    0.03 BIN1 + 0.05 BIN2 + 0.08 BIN3 + 0.02 BIN4 + 0.06 BIN5 
  466.         + 0.01 ALUM <= 100
  467.  MG:    0.02 BIN1 + 0.03 BIN2 + 0.01 BIN5 <= 30
  468.  AL:    0.7 BIN1 + 0.75 BIN2 + 0.8 BIN3 + 0.75 BIN4 + 0.8 BIN5 
  469.         + 0.97 ALUM >= 1500
  470.  SI:    0.02 BIN1 + 0.06 BIN2 + 0.08 BIN3 + 0.12 BIN4 + 0.02 BIN5 
  471.         + 0.01 ALUM + 0.97 SILCON <= 300
  472. and
  473.         0 <= BIN1 <= 200
  474.         0 <= BIN2 <= 750
  475.         400 <= BIN3 <= 800
  476.         100 <= BIN4 <= 700
  477.         0 <= BIN5 <= 1500
  478.  
  479. --------------------------------------------------------------------------
  480.  
  481. 6.  "What software is there for nonlinear optimization?"
  482.  
  483. A:  I don't claim very much expertise in this area, but the question is 
  484. frequent enough to be worth addressing.  If I get enough feedback, this 
  485. section might grow large enough to need to be split off as a separate 
  486. FAQ list.
  487.  
  488. It's unrealistic to expect to find one general NLP code that's going to
  489. work for every kind of nonlinear model.  Instead, you should try to find 
  490. a code that fits the problem you are solving.  Nonlinear solution techniques 
  491. can be divided into various categories, such as unconstrained, linearly 
  492. constrained, convexly constrained, or general.  If your problem doesn't
  493. fit in any category except "general", or if you insist on a proven optimal
  494. solution (except when there no chance of encountering multiple local minima), 
  495. you should be prepared to have to use a method that boils down to exhaustive 
  496. search, i.e., you have an intractable problem.  See the comments in the MIP 
  497. section on Simulated Annealing and Genetic Algorithms.
  498.  
  499. Several of the commercial LP codes referenced above have specialized 
  500. routines, particularly for Quadratic Programming (QP, linear constraints
  501. with a quadratic objective function).  Many nonlinear problems can be
  502. solved (or at least confronted) by application of a sequence of LP or 
  503. QP approximations.
  504.  
  505. There is an ACM TOMS routine for QP, #587, available from the netlib server,
  506. in directory /netlib/toms.  See the section on test models for detail on 
  507. how to use this server.
  508.  
  509. There is a directory, /netlib/opt, on the netlib server containing a 
  510. collection of optimization routines.  The last time I checked, I saw 
  511. - "praxis" (unconstrained optimization, without requiring derivatives)  
  512. - "tn" (Newton method for unconstrained or simple-bound optimization)
  513. - "ve08" (optimization of unconstrained separable function).
  514. - "simann" (unconstrained optimization using Simulated Annealing)
  515. - "vfsr" (constrained optimization using Simulated Annealing)
  516. - "subplex" (unconstrained optimization of general multivariate functions)
  517. Again, see the section on test models for detail on how to use this server.
  518.  
  519. Here is a summary of codes mentioned in newsgroups in the past year, not 
  520. sorted into categories.
  521.  
  522. - MINOS - Stanford University, Office of Technology Licensing, 415-723-0651.
  523.   Mailing address: 350 Cambridge Ave., Suite 250, Palo Alto, CA 94306 (USA).
  524.   This code is often used by researchers as a "benchmark" for others to 
  525.   compare with.
  526. - NPSOL - Stanford University, Office of Technology Licensing.
  527. - LSSOL - Stanford University, Office of Technology Licensing.
  528.   This code does convex (positive semi-definite) QP.  Is the QP solver
  529.   used in current versions of NPSOL.
  530. - NAG Library routine E04UCF (essentially the same as NPSOL).
  531. - IMSL routine UMINF and UMIDH.
  532. - Harwell Library routine VF04.
  533. - Hooke and Jeeves algorithm - reference?
  534. - MINPAK I and II - Contact Steve Wright, wright@mcs.anl.gov
  535. - GENOCOP - Genetic algorithm, Zbigniew Michalewicz, zbyszek@mosaic.uncc.edu
  536.   said to be available by ftp at unccsun.uncc.edu (152.15.10.88).
  537. - DFPMIN - Numerical Recipes  (Davidon-Fletcher-Powell)
  538. - Amoeba - Numerical Recipes
  539. - Brent's Method - Numerical Recipes
  540. - FSQP -  Contact Andre Tits, andre@src.umd.edu.  Said to be free of charge 
  541.   to academic users.  Solves general nonlinear constrained min-max problems.
  542. - QLD - Contact: Klaus.Schittkowski@uni-bayreuth.de.  Solves Quadratic 
  543.   Programming problems.  
  544. - CONMIN - Vanderplaats and Associates, Goleta CA
  545. - NOVA - DOT Products, Houston TX
  546. - GRG2 - Leon Lasdon, University of Texas, Austin TX
  547. - GINO - LINDO Systems, Chicago, IL
  548.  
  549. --------------------------------------------------------------------------
  550.  
  551. 7.  "Just a quick question..."
  552.  
  553. Q:  What is a matrix generator?
  554. A:  This is a code that creates input for an LP (or MIP, or NLP) code, 
  555.     using a more natural input than MPS format.  There are no free ones.  
  556.     Matrix generators can be roughly broken into two classes, column
  557.     oriented ones, and equation oriented ones.  The former class is
  558.     older, and includes such commercial products as OMNI (Haverley Systems)
  559.     and DATAFORM (Ketron).  Big names in the latter class are GAMS 
  560.     (Scientific Press), LINGO (LINDO Systems), and AMPL (information 
  561.     is in netlib/opt on the Netlib server).  These products have links 
  562.     to various solvers (commercial and otherwise).
  563.  
  564. Q:  How do I diagnose an infeasible LP model?
  565. A:  A model is infeasible if the constraints are inconsistent, i.e., if
  566.     no feasible solution can be constructed.  It's often difficult to track 
  567.     down a cause.  The cure may even be ambiguous: is it that some demand 
  568.     was set too high, or a supply set too low?  A useful technique is Goal 
  569.     Programming, one variant of which is to include two explicit slack 
  570.     variables (positive and negative), with huge cost coefficients, in each 
  571.     constraint.  The revised model is guaranteed to have a solution, and you 
  572.     can look at which rows have slacks that are included in the "optimal" 
  573.     solution.  By the way, I recommend a Goal Programming philosophy even if 
  574.     you aren't having trouble with feasibility; "come on, you could probably 
  575.     violate this constraint for a price."  Another approach is Fourier-
  576.     Motzkin Elimination (article by Danztig and Eaves in the Journal of
  577.     Combinatorial Theory (A) 14, 288-297 (1973).  Lastly, a software system
  578.     called ANALYZE was developed by Harvey Greenberg to provide computer-
  579.     assisted analysis, including rule-based intelligence.  For further 
  580.     information about this code, and a bibliography of more than 400 
  581.     references on the subject of model analysis, contact Harvey at 
  582.     HGREENBERG@cudnvr.denver.colorado.edu.
  583.  
  584. Q:  I want to know specifically which constraints contradict each other.
  585. A:  This may not be a well posed problem.  If by this you mean you want to 
  586.     find the minimal set of constraints that should be removed to restore 
  587.     feasibility, this can be modeled as an Integer LP (which means, it's 
  588.     potentially a harder problem than the underlying LP itself). Start with 
  589.     a Goal Programming approach as outlined above, and introduce some 0-1 
  590.     variables to turn the slacks off or on.  Then minimize on the sum of 
  591.     these 0-1 variables.  An article covering aspects of this question is
  592.     by Chinneck and Dranieks in the Spring 1991 ORSA Journal on Computing.
  593.  
  594. Q:  I just want to know whether or not there *exists* a feasible solution.
  595. A:  From the standpoint of computational complexity, finding out if a 
  596.     model has a feasible solution is essentially as hard as finding the 
  597.     optimal LP solution, within a factor of 2 on average, in terms of 
  598.     effort in the Simplex Method.  There are no shortcuts in general, 
  599.     unless you know something useful about your model's structure (e.g.,
  600.     if you are solving some form of a transportation problem, you may
  601.     be able to assure feasibility by checking that the sources add up 
  602.     to at least as great a number as the sum of the destinations).
  603.  
  604. Q:  I have an LP, except it's got several objective functions.  
  605. A:  This is indeed a difficult class of model.  Fundamental to it is that
  606.     there may no longer be one unique solution.  Approaches that have worked 
  607.     are Goal Programming (treat the objectives as constraints with costed
  608.     slacks), Pareto preference analysis, and forming a composite objective
  609.     from the real ones.  There is a section on this whole topic in Reference
  610.     [1].  My general advice is to attempt to cast your model in terms of 
  611.     physical realities, or dollars and cents, wherever possible; sometimes 
  612.     the multiple objectives disappear!  8v)
  613.  
  614. Q:  I have an LP that has large almost-independent matrix blocks that are
  615.     linked by a few constraints.  Can I take advantage of this?
  616. A:  In theory, yes.  See section 6.2 in Reference [1] for a discussion of 
  617.     Dantzig-Wolfe decomposition.  However, I am unaware of any commercial 
  618.     codes that will help you do this, so you'll have to create your own 
  619.     framework and then call your chosen LP solver to solve the subproblems.  
  620.     The folklore is that generally such schemes take a long time to converge 
  621.     so that they're slower than just solving the model as a whole.  My 
  622.     advice, unless your model is so huge that a good solver can't fit it
  623.     in memory, is to not bother decomposing it.  It's probably more cost 
  624.     effective to upgrade your solver, if the algorithm is limiting you,
  625.     than to invest your time; but I suppose that's an underlying theme in
  626.     a lot of my advice. 8v) 
  627.  
  628. Q:  I need to find all integer points in a polytope.
  629. A:  There is no known way of doing this efficiently (i.e., with an algorithm
  630.     that grows only polynomially with the problem size).  A related question
  631.     is how to find all the vertices of an LP, with the same pessimistic
  632.     answer.  The book by Schrijver is said to discuss this.  For small
  633.     models, it may be practical to find your answer by complete enumeration.
  634.  
  635. Q:  Are there any parallel LP codes?
  636. A:  IBM has announced a parallel Branch and Bound capability in their 
  637.     package OSL, for use on clusters of workstations.  "This is real, live 
  638.     commercial software, not a freebie. Contact  forrest@watson.ibm.com".
  639.     Jeffrey Horn (horn@cs.wisc.edu) recently compiled a bibliography of
  640.     papers relating to research on parallel B&B.  There is an annotated
  641.     bibliography of parallel methods in Operations Research in general,
  642.     in Vol 1 (1), 1989 of the ORSA Journal on Computing, although by now 
  643.     it might be a little out of date.
  644.     I'm not aware of any implementations (beyond the "toy" level) of sparse
  645.     simplex or interior-point solvers on parallel machines.  
  646.  
  647. Q:  I am trying to solve a Traveling Salesman Problem ...
  648. A:  TSP is a famously hard problem that has attracted many of the best minds 
  649.     in the field.  Look at the bibliography in the Integer Programming section 
  650.     of Reference [1], particularly the ones with the names Groetschel and/or 
  651.     Padberg in them.  I don't believe there are any commercial products to 
  652.     solve this problem.  For that matter, I'm not aware of any public domain
  653.     codes either.
  654.  
  655. Q:  I heard about a Russian algorithm for Traveling Salesman Problems.
  656. A:  You are speaking of Khachian's method for LP, published in 1979.  The 
  657.     connection to TSP is false, brought about by an erroneous New York Times 
  658.     article back then.  It was the first LP algorithm to have a polynomial 
  659.     bound on the amount of work.  Though important theoretically, it has had 
  660.     no impact in practice, because the polynomial bound is huge.  (It was
  661.     Karmarkar's method [1984] that was the first *practical* polynomial
  662.     algorithm for LP.)  Khachian's method works by surrounding the solution 
  663.     space with a sequence of shrinking ellipsoids.  There continues to be 
  664.     some research done on related methods, for NLP.   
  665.  
  666. Q:  I need to do post-optimal analysis.
  667. A:  Many commercial LP codes have features to do this.  Also called Ranging
  668.     or Sensitivity Analysis, it gives you information about how much the
  669.     coefficients in the problem could change without affecting the nature of 
  670.     the solution.  Most LP textbooks, such as Reference [1], describe this.
  671.     Unfortunately, all this theory applies only to LP.
  672.  
  673.     For a MIP model with both integer and continuous variables, you could 
  674.     get a limited amount of information by fixing the integer variables at 
  675.     their optimal values, resolving the model as an LP, and doing standard 
  676.     post-optimal analyses on the remaining continuous variables.  Another 
  677.     MIP approach would be to choose the coefficients of your model that are 
  678.     of the most interest, and generate "scenarios" using values within a 
  679.     stated range created by a random number generator.  Perhaps five or ten 
  680.     scenarios would be sufficient; you would solve each of them, and by some 
  681.     means compare, contrast, or average the answers that are obtained.  
  682.     Noting patterns in the solutions, for instance, may give you an idea of 
  683.     what solutions might be most stable.  A third approach would be to 
  684.     consider a goal-programming formulation;  perhaps your desire to see 
  685.     post-optimal analysis is an indication that some important aspect is 
  686.     missing from your model.
  687.  
  688. Q:  Some versions of the simplex algorithm require as input a vertex.  Do
  689.     all systems require a vertex?
  690. A:  No.  You just have to give an LP code the constraints and the objective
  691.     function, and it will construct the vertices for you.  Most codes go 
  692.     through a so-called two phase method, wherein the code first looks for 
  693.     a feasible solution, and then works on getting an optimal solution.  The 
  694.     first phase can begin anywhere, such as with all the variables at zero.  
  695.     So, no, you don't have to give a code a starting point.  On the other 
  696.     hand, it is not uncommon to do so, because it can speed up the solution 
  697.     time tremendously.  Commercial codes usually allow you to do this (they 
  698.     call it a "basis", though that's a loose usage of a specific linear 
  699.     algebra concept); free codes generally don't.  You'd normally want to 
  700.     bother with a starting basis only when solving families of related and 
  701.     difficult LP's (i.e., in some sort of production mode).
  702.  
  703. --------------------------------------------------------------------------
  704.  
  705. 8.  "What references are there in this field?"
  706.  
  707. A:  Too many to count.  Here are a few that I like or have been 
  708. recommended on the net.  I have *not* reviewed them all.
  709.  
  710. General reference  [1]
  711. - Nemhauser, Rinnooy Kan, & Todd, eds, Optimization, North-Holland, 1989.
  712.   (Very broad-reaching, with large bibliography.  Good reference; it's the 
  713.   place I tend to look first.  Expensive, and tough sledding for beginners.)
  714.  
  715. LP 
  716. - Chvatal, Linear Programming, Freeman, 1983.  (I find it hard to whole-
  717.   heartedly recommend any one LP textbook, but this is one I'd probably use
  718.   in teaching an undergraduate course.)
  719. - Hughes & Grawiog, Linear Programming: An Emphasis on Decision Making,
  720.   Addison-Wesley, 1973.  
  721. - Luenberger, Introduction to Linear and Nonlinear Programming, Addison 
  722.   Wesley, 1984.  (Updated version of an old standby.)
  723. - Murtagh, B., Advanced Linear Programming, McGraw-Hill, 1981.  (Good one
  724.   after you've read an introductory text.)
  725. - Murty, K., Linear and Combinatorial Programming.
  726. - Schrijver, Theory of Linear and Integer Programming, Wiley.
  727. - Williams, H.P., Model Building in Mathematical Programming, Wiley 1985.
  728.   (Little on algorithms, but excellent for learning what makes a good model.)
  729.  
  730. Interior Point LP
  731. - Marsten, et al., "Interior point methods for linear programming", 
  732.   Interfaces, pp 105-116, July-August 1990.  (Introductory article, written 
  733.   by authors of a good commercial code.)
  734. - Marsten, et al., article to appear in ORSA Journal on Computing, 1993.
  735.   (The latest results; a tech report version may be available sooner.)
  736. - Wright, M., "Interior methods for constrained optimization", Acta 
  737.   Mathematica, Cambridge University Press, 1992.  (Survey article.)
  738. There is also a bibliography (with over 1000 entries!?!) obtainable by 
  739. mailing to "netlib@ornl.gov" and saying "send intbib.bib from bib".
  740.  
  741. Nonlinear Programming  (can someone help classify these more usefully?)
  742. - Bazaraa & Shetty, Nonlinear Programming, Theory & Applications.
  743. - Coleman & Li, Large Scale Numerical Optimization, SIAM Books.
  744. - Dennis & Schnabel, Numerical Methods for Unconstrained Optimization
  745.   and Nonlinear Equations, Prentice Hall, 1983.
  746. - Fiacco & McCormick, Sequential Unconstrained Minimization Techniques,
  747.   SIAM Books.  (An old standby, given new life by the interior point
  748.   LP methods.)
  749. - Fletcher, R., Practical Methods of Optimization, Wiley 1987.  (Good
  750.   reference for Quadratic Programming, among other things.)
  751. - Floudas & Pardalos, A collection of test problems for constrained
  752.   optimization algorithms, Springer-Verlag, 1990.
  753. - Gill, Murray & Wright, Practical Optimization, Academic Press, 1981.
  754.   (An instant NLP classic when it was published.)
  755. - Hock & Schittkowski, Test Examples for Nonlinear Programming Codes,
  756.   Springer-Verlag, 1981.
  757. - Kahaner, Moler & Nash, Numerical Methods and Software, Prentice-Hall.
  758. - More, "Numerical Solution of Bound Constrained Problems", in Computational
  759.   Techniques & Applications, CTAC-87, Noye & Fletcher, eds, North-Holland,
  760.   29-37,  1988.
  761. - More & Toraldo, Algorithms for Bound Constrained Quadratic Programming
  762.   Problems, Numerische Mathematik 55, 377-400, 1989.
  763. - Nocedal, J., summary of algorithms for unconstrained optimization
  764.   in "Acta Numerica 1992".
  765. - Schittkowski, Nonlinear Programming Codes, Springer-Verlag, 1980.
  766. - Torn & Zilinskas, Global Optimization, Springer-Verlag, 1989.
  767.  
  768. Simulated Annealing
  769. - Harland & Salamon, "Simulated annealing: A review of the thermodynamic 
  770.   approach" Nuclear Physics B (Proc. Suppl.) 5A (1988) pp. 109-115.
  771. - Ruppeiner et al, "Ensemble approach to simulated annealing"
  772.   J. Phys. I vol. 1 (1991) 455-470.
  773. - Hoffman, et al, "Optimal ensemble size for parallel implementations
  774.   of simulated annealing" Appl. Math. Lett. vol. 3, no. 3 (1990) 53-56.
  775. - Kirkpatrick, Gelatt & Vecchi, Optimization by Simulated Annealing,
  776.   Science, 220 (4598) 671-680, 1983.
  777.  
  778. Simulated Re-Annealing
  779. - Ingber & Rosen, "Genetic algorithms and very fast simulated annealing: 
  780.   a comparison" Mathematical and Computer Modelling, 16(11) 1992, 87-100.
  781. - Ingber "Very fast simulated re-annealing" Mathematical and Computer
  782.   Modelling, 12(8) 1989, 967-973
  783.  
  784. Genetic Algorithms
  785. - De Jong, "Genetic algorithms are NOT function optimizers" in Foundations 
  786.   of Genetic Algorithms: Proceedings 24-29 July 1992, D.  Whitley (ed.) 
  787.   Morgan Kaufman
  788. - Ackley, "An empirical study of bit vector function optimization" in Genetic 
  789.   Algorithms and Simulated Annealing, L. Davis (ed.) Morgan Kaufman (1987)
  790.  
  791. Other publications
  792. - Davis, L. (ed.), Genetic Algorithms and Simulated Annealing, Morgan Kaufmann, 
  793.   1989.
  794. - Forsythe, Malcolm & Moler, Computer Methods for Mathematical Computations, 
  795.   Prentice-Hall.
  796. - Greenberg, H.J., A Computer-Assisted Analysis System for Mathematical 
  797.   Programming Models and Solutions: A User's Guide for ANALYZE, Kluwer 
  798.   Academic Publishers, 1993.
  799. -Hansen, Global Optimization Using Interval Analysis, Marcel Dekker, 1991(?).
  800.   (I'd be interested if anyone has any opinions on this one.)
  801. - Kennington & Helgason, Algorithms for Network Programming, Wiley, 1980.
  802.   (A special case of LP.)
  803. - Press, Flannery, Teukolsky & Vetterling , Numerical Recipes, Cambridge,
  804.   1986.    (Comment: use with care.)
  805.  
  806.  
  807. --------------------------------------------------------------------------
  808.  
  809. 9.  "Who maintains this FAQ list?"
  810.  
  811. A:  John W. Gregory
  812.     Applications Department
  813.     Cray Research, Inc.
  814.     Eagan, MN 55121   USA
  815.     jwg@cray.com
  816.     612-683-3673
  817.  
  818. I suppose I should say something here to the effect that "the material
  819. in this document does not reflect any official position taken by Cray 
  820. Research, Inc."  Also, "use at your own risk", "no endorsement of products
  821. mentioned", etc., etc.  I probably should have scattered more "IMHO"s 
  822. around in the text, but that acronym seems weaselly and once you start it's 
  823. hard to know where to stop.  I should have put in a few more smilies here 
  824. and there too, to assist the humor impaired - be on your toes.  8v) 
  825.  
  826. I've tried to keep my own biases (primarily, toward the high end of 
  827. computing) from dominating what I write here, and other viewpoints that
  828. I've missed are welcome.  Suggestions, corrections, topics you'd like to 
  829. see covered, and additional material (particularly on NLP) are solicited.  
  830. Comments to the effect "who died and made *you* optimal?" will likely 
  831. be ignored.  8v)
  832.  
  833. I regret that when I started this list I didn't keep careful track of all 
  834. the contributors whose suggestions I incorporated into the FAQ.  In several 
  835. instances, the information herein comes from postings on the net, which I 
  836. assumed to be fair use and in the public domain.  It being too late now to 
  837. make individual acknowledgements, I offer a blanket thanks to all who have 
  838. posted on these topics to the net.
  839.  
  840. This FAQ list is also being posted to news.answers and sci.answers, and is 
  841. archived in the periodic posting archive on rtfm.mit.edu [18.172.1.27],
  842. in the anonymous ftp directory /pub/usenet/sci.answers.  The name under 
  843. which FAQs are archived appears in the Archive-name line at the top of the 
  844. article.  This FAQ is archived as linear-programming-faq.Z (compressed).  
  845. You will find many other FAQs, covering a staggering variety of topics, in 
  846. this hierarchy.  There's a mail server on that machine. You can send an 
  847. e-mail message to  mail-server@pit-manager.mit.edu  containing: 
  848. send usenet/sci.answers/linear-programming-faq
  849. as the body of the message.
  850.  
  851. Copies of this FAQ list may be made freely, as long as it is distributed 
  852. at no charge and with this disclaimer included.
  853.  
  854. --------------------------------------------------------------------------
  855. END lp_faq
  856.