Linear Programming FAQ
From NEOS
The Linear Programming FAQ was established by John W. Gregory and is currently being maintained by Robert Fourer and the Optimization Technology Center of Argonne National Laboratory and Northwestern University. Changes are posted to Usenet newsgroup sci.op-research. Date of this version: September 1, 2005.
What is Linear Programming?
(For rigorous definitions and theory, which are beyond the scope of this document, the interested reader is referred to the many LP textbooks in print, a few of which are listed in the references section.)
A Linear Program (LP) is a problem that can be expressed as follows (the so-called Standard Form):
| minimize | cx |
| subject to | Ax = b |
,
|
where x is the vector of variables to be solved for, A is a matrix of known coefficients, and c and b are vectors of known coefficients. The expression "cx" is called the objective function, and the equations "Ax = b" are called the constraints. All these entities must have consistent dimensions, of course, and you can add "transpose" symbols to taste. The matrix A is generally not square, hence you don't solve an LP by just inverting A. Usually A has more columns than rows, and Ax = b is therefore quite likely to be under-determined, leaving great latitude in the choice of x with which to minimize cx over the intersection of the constraints with the nonnegative orthant
.
The word "Programming" is used here in the sense of "planning"; the necessary relationship to computer programming was incidental to the choice of name. Hence the phrase "LP program" to refer to a piece of software is not a redundancy, although I tend to use the term "code" instead of "program" to avoid the possible ambiguity.
Although all linear programs can be put into the Standard Form, in practice it may not be necessary to do so. For example, although the Standard Form requires all variables to be non-negative, most good LP software allows general bounds
, where l,u are vectors of known lower and upper bounds. Individual elements of these bounds vectors can even be infinity and/or minus-infinity. This allows a variable to be without an explicit upper or lower bound, although of course the constraints in the A-matrix will need to put implied limits on the variable or else the problem may have no finite solution. Similarly, good software allows
for arbitrary
; the user need not hide inequality constraints by the inclusion of explicit "slack" variables, nor write
and
as two separate constraints. Also, LP software can handle maximization problems just as easily as minimization (in effect, the vector c is just multiplied by − 1).
The importance of linear programming derives in part from its many applications (see further below) and in part from the existence of good general-purpose techniques for finding optimal solutions. These techniques take as input only an LP in the above Standard Form, and determine a solution without reference to any information concerning the LP's origins or special structure. They are fast and reliable over a substantial range of problem sizes and applications.
Two families of solution techniques are in wide use today. Both visit a progressively improving series of trial solutions, until a solution is reached that satisfies the conditions for an optimum. Simplex methods, introduced by Dantzig about 50 years ago, visit "basic" solutions computed by fixing enough of the variables at their bounds to reduce the constraints Ax = b to a square system, which can be solved for unique values of the remaining variables. Basic solutions represent extreme boundary points of the feasible region defined by Ax = b,
, and the simplex method can be viewed as moving from one such point to another along the edges of the boundary. Barrier or interior-point methods, by contrast, visit points within the interior of the feasible region. These methods derive from techniques for nonlinear programming that were developed and popularized in the 1960s by Fiacco and McCormick, but their application to linear programming dates back only to Karmarkar's innovative analysis in 1984.
The related problem of [integer programming] (or integer linear programming, strictly speaking) requires some or all of the variables to take integer (whole number) values. Integer programs (IPs) often have the advantage of being more realistic than LPs, but the disadvantage of being much harder to solve. The most widely used general-purpose techniques for solving IPs use the solutions to a series of LPs to manage the search for integer solutions and to prove optimality. Thus most IP software is built upon LP software, and this FAQ applies to problems of both kinds.
Linear and integer programming have proved valuable for modeling many and diverse types of problems in planning, routing, scheduling, assignment, and design. Industries that make use of LP and its extensions include transportation, energy, telecommunications, and manufacturing of many kinds. A sampling of applications can be found in many [#textbooks LP textbooks], in [#modeling_systems books on LP modeling systems], and among the application cases in the journal Interfaces.
Where is there good software to solve LP problems?
Thanks to the advances in computing of the past decade, linear programs in a few thousand variables and constraints are nowadays viewed as "small". Problems having tens or hundreds of thousands of continuous variables are regularly solved; tractable integer programs are necessarily smaller, but are still commonly in the hundreds or thousands of variables and constraints. The computers of choice for linear and integer programming applications are Pentium-based PCs and the several varieties of Unix workstations.
There is more to linear programming than optimal solutions and number-crunching, however. This can be appreciated by observing that modern LP software comes in two related but very different kinds of packages:
- Algorithmic codes are devoted to finding optimal solutions to specific linear programs. A code takes as input a compact listing of the LP constraint coefficients (the A, b, c and related values in the [#Q1 standard form]) and produces as output a similarly compact listing of optimal solution values and related information.
- Modeling systems are designed to help people formulate LPs and analyze their solutions. An LP modeling system takes as input a description of a linear program in a form that people find reasonably natural and convenient, and allows the solution output to be viewed in similar terms; conversion to the forms requried by algorithmic codes is done automatically. The collection of statement forms for the input is often called a modeling language.
Most modeling systems support a variety of algorithmic codes, while the more popular codes can be used with many different modeling systems. Because packages of the two kinds are often bundled for convenience of marketing or operation, the distinction between them is sometimes obscured, but it is important to keep in mind when attempting to sort through the many alternatives available.
Large-scale LP algorithmic codes rely on general-structure sparse matrix techniques and numerous other refinements developed through years of experience. The fastest and most reliable codes thus represent considerable development effort, and tend to be expensive except in very limited demonstration or "student" versions. Those codes that are free -- to all, or at least for research and teaching -- tend to be somewhat less robust, though they are still useful for many problems. The ability of a code to solve any particular class of problems cannot easily be predicted from problem size alone; some experimentation is usually necessary to establish difficulty.
Large-scale LP modeling systems are commercial products virtually without exception, and tend to be as expensive as the commercial algorithmic codes (again with the exception of small demo versions). They vary so greatly in design and capability that a description in words is adequate only to make a preliminary decision among them; your ultimate choice is best guided by using each candidate to formulate a model of interest.
Listed below are summary descriptions of available [#free free codes], and a tabulation of many [#commercial commercial codes and modeling systems] for linear (and integer) programming. A list of [#freedemos free demos] of commercial software appears at the end of this section.
Another useful source of information is the Optimization Software Guide by Jorge More' and Stephen Wright. It contains references to about 75 available software packages (not all of them just LP), and goes into more detail than is possible in this FAQ; see in particular the sections on "linear programming" and on "modeling languages and optimization systems." An updated Web version of this book is available on the NEOS Guide. Another good source of feature summaries and contact information is the Linear Programming Software Survey compiled by OR/MS Today (which also has the largest selection of advertisements for optimization software). Much information can also be obtained through the websites of optimization software developers, many of which are identified in the writeup and tables below.
When evaluating any performance comparison, whether performed by a customer, vendor, or disinterested third party, keep in mind that all high-quality codes provide options that offer superior performance on certain difficult kinds of LP or IP problems. Benchmark studies of the "default settings" of codes will fail to reflect the power of any optional settings that are applicable.
"Free" codes
Some of these programs require registration or payment for some (especially commercial) uses. Conditions of use are also subject to change. It is a good practice to check a code's documentation for restrictions before committing to use it.
These codes are not as fast or robust on average as the commercial products, but they're a a reasonable first try if you're not sure what level of power you need.
Free solvers are often distributed in the form of source code, most commonly in the C programming language. They are provided as callable libraries with documented interfaces, so that they are readily built into larger optimization schemes and application packages. They also provide a good start if you want to experiment with modifications to their methods.
If you just want to solve a linear or integer program, however, then you should give some thought in advance to the work that will be involved in compiling a solver library and writing a program to generate your optimization problem, call the solver routines, and process the results. Especially if you have a small problem -- a few dozen to a few hundred variables and constraints -- you may find that the [#freedemos demo versions] of commercial software can meet your needs with much less investment of effort. If you prefer not to download solvers at all, a variety of free and commercial codes can also be executed through the NEOS Server, generally without preset limits on problem size.
Solvers based on the simplex method:
There are currently three very active projects to develop open source software for simplex-based linear and integer programming:
- CLP (linear) and SBB (integer), supervised by John Forrest. Current versions are available under the Common Public License written by IBM Corporation. They are part of the COIN-OR project which encompasses a variety of software for operations research, especially optimization; COIN-OR was initially sponsored by IBM but is now an independent non-profit organization.
- GLPK (GNU Linear Programming Kit), supervised by Andrew Makhorin. Version 4.6 is available under the GNU General Public License, version 2 or higher. A primal-dual interior point method is also provided. Input options include the GNU MathProg language (a subset of [#AMPL AMPL]).
- lp_solve, supervised by by Kjell Eikland and Peter Notebaert. Version 5.1 is now available, under the GNU Lesser General Public License. Utilities are provided for handling various input formats, including GLPK's MathProg modeling language. Several alternative basis factorization packages can be used interchangeably.
All of these solvers have monitored mailing lists for questions, bug reports, and suggestions. Instructions and examples are included for compiling and running in various environments.
Several other simplex codes have special features that may be of interest:
LP-Optimizer is a simplex-based code for linear and integer programs, written by Markus Weidenauer (weidenauer@netcologne.de). Free Borland Pascal 7.0 and Borland Delphi 4 source is available for downloading, as are executables for DOS and for Windows (95 or later).
SoPlex is an object-oriented implementation of the primal and dual simplex algorithms, developed by Roland Wunderling. Source code is available free for research uses at noncommercial and academic institutions.
Among the SLATEC library routines is a Fortran sparse implementation of the simplex method, SPLP. Its documentation states that it can solve LP models of "at most a few thousand constraints and variables".
EXLP solves linear programs of moderate size in exact rational arithmetic, using the GNU Multiple Precision Arithmetic Library.
Solvers based on interior-point methods:
The [#GLPK GLPK] package includes an interior-point solver.
The Optimization Technology Center at Argonne National Laboratory and Northwestern University has developed PCx, an interior-point code that is freely available for downloading. PCx is available in Fortran or C source or a variety of Windows and Unix executables, with an optional Java-based GUI interface. Input can be specified in [#Q5 MPS form] or by use of the AMPL modeling language.
Csaba Meszaros has written BPMPD, an interior-point code for linear and convex quadratic programs. A demonstration version, which solves problems of any size but does not report optimal values of the variables for problems larger than about 500 x 500, is available as a Windows95/NT executable or DLL. Separately, a large variety of Unix binaries for Linux and four workstation platforms are available for downloading.
mailto:gondzio@maths.ed.ac.uk Jacek Gondzio has developed the interior-point LP (and convex QP) solver HOPDM. Several papers (also available at the HOPDM website) detail the features of this solver, which include automatic selection of multiple centrality correctors and factorization method, and a "warm start" feature for taking advantage of known solutions. A public-domain Fortran version (2.13, LP only) can be downloaded, and a newer C version (2.30) is available on request to the developer.
Denis Smirnov has developed GIPALS, an environment that incorporates an interior-point solver and simple graphical user interface to specify, import and solve linear programs. A trial version is freely downloadable.
Modeling systems:
Zimpl, developed by Thorsten Koch, translates a description of an algebraic model and data to an [#Q5 MPS format] problem instance that can serve as input to various solvers. It is available as open source under the GNU General Public License.
The open source "scenario scripting language" IPAT-S includes support for linear programming problems, using the [#lp_solve lp_solve] library.
Other software of interest:
COIN-OR, a COmputational INfrastructure for Operations Research, is an open source repository established with support from IBM Corporation and now operating as an independent nonprofit organization. Source code initially available includes a parallel branch-cut-price framework, a cut generation library, an implementation of the Volume Algorithm for fast approximate solutions to combinatorial problems, and an open solver interface layer (along with several packages for nonlinear optimization).
ABACUS is a C class library that "provides a framework for the implementation of branch-and-bound algorithms using linear programming relaxations that can be complemented with the dynamic generation of cutting planes or columns" (branch-and-cut and/or branch-and-price). It relies on CPLEX, SoPlex, or Xpress-MP to solve linear programs. Further information is available from Stefan Thienel, thienel@informatik.uni-koeln.de.
Various small-scale implementations are mainly intended for instructional purposes.
- Robert Vanderbei of Princeton has developed Java-based tools for facilitating simplex pivots and facilitating network simplex pivots, and well as a variety of Java applets that test students on their knowledge of various simplex-based methods.
- A web-based Linear Program Solver with Simplex, part of the RIOT project at Berkeley, appears to be useful for solving small models that can be entered by hand.
- The NEOS Guide developed by Northwestern and Argonne National Laboratory offers a Java-based Simplex Tool that demonstrates the workings of the simplex method on small user-entered problems.
The Operations Research Laboratory at Seoul National University, Korea offers C source for large-scale Linear Programming software (both Simplex and Barrier) and for numerous more specialized optimization problems.
Will Naylor has a collection of software he calls WNLIB. Routines of interest include a dense-matrix simplex method for linear programming (with anti-cycling and numerical stability "hacks") and a sparse-matrix transportation/assignment problem routine. (WNLIB also contains routines pertaining to nonlinear optimization.)
A code known as lp is Mike Hohmeyer's C implementation of Raimund Seidel's O(d! n) time linear programming algorithm. It's reputed to be extremely fast in low dimensions (say, d { 10), so that it's appropriate for a variety of geometric problems, especially with very large numbers of constraints.
The next several suggestions are for codes that are severely limited by the dense vector and matrix algebra employed in their implementations; they may be OK for models with (on the order of) 100 variables and constraints, but it's unlikely they will be satisfactory for larger models. In the words of Matt Saltzman:
The main problems with these codes have to do with scaling, use of explicit inverses and lack of reinversion, and handling of degeneracy. Even small problems that are ill-conditioned or degenerate can bring most of these tableau codes to their knees. Other disadvantages for larger problems relate to sparsity, pricing, and maintaining the complete nonbasic portion of the tableau. But for small, dense problems these difficulties may not be serious enough to prevent such codes from being useful, or even preferable to more "sophisticated" sparse codes. In any event, use them with care.
- For DOS/PC users, there is a "friendly Linear Programming and Linear Goal Programming" code called LINSOLVE, developed by Prof. Timo Salmi (ts@uwasa.fi).
- Also on the garbo server is a LP 2.61, a shareware linear and integer programming code of Cornel Huth, distributed as PC binaries. It accepts text and spreadsheet files as input.
- There is an ACM TOMS routine for LP, #552. This routine was designed for fitting data to linear constraints using an L1 norm, but it uses a modification of the Simplex Method and could presumably be modified to satisfy LP purposes.
- There are books that contain source code for the Simplex Method. See the section on [#books_with_source references]. You should not expect such code to be robust. In particular, you can check whether it uses a 2-dimensional array for the A-matrix; if so, it is surely using the tableau Simplex Method rather than sparse methods, and Saltzman's comments will apply.
- OR-Objects is a Java class library that includes objects for dense linear programming (and other methods common in operations research).
- Pysimplex contains an implementation of the simplex method in the object-oriented language Python, together with modules that allow construction of models in a straightforward symbolic manner.
For Macintosh OS X users, the only option provided by current linear and integer programming software is to run under the Unix environment provided by the Terminal utility. Netlib has Mac OS X binaries for the student version of AMPL and three compatible solvers. Other possibilities are provided by various packages distributed as open C source.
Stephen F. Gale (sfgale@calcna.ab.ca) writes:
- Available at my website is a fairly simple Simplex Solver written for Turbo Pascal 3.0. The original algorithm is from the book "Some Common BASIC Programs" by Lon Poole and Mary Borchers (ISBN 0-931988-06-3). However, I revised it considerably when I converted it to Pascal. I then added Sensitivity Analysis based on the book "The Operations Research Problem Solver" (ISBN 0-87891-548-6). I have tested the program on over 30 textbook problems, but never used it for real life applications. If someone finds a problem with the program, I would be pleased to correct it. I would also appreciate knowing how the program was used.
The following suggestions may represent low-cost ways of solving LPs if you already have certain software available to you.
- All of the most popular spreadsheet programs come with a limited linear/integer programming solver as a feature or add-in. A much broader range of more powerful solvers are available for separate purchase from LINDO Systems and Frontline Systems. Some of these solvers give special attention to common spreadsheet functions such as MIN, IF, and LOOKUP that can be handled by linear or integer programming approaches.
- QSB for Windows by Yih-Long Chang, published by Wiley, has an LPf module among its routines.
- If you have access to a commercial math library, such as SAS, IMSL or NAG, you may be able to use an LP routine from there.
- The open source R Project for Statistical Computing provides functional interfaces to several linear programming routines.
- If you have MATLAB, you can run a number of useful optimization packages that provide some linear programming features:
- The MATLAB Optimization Toolbox.
- The TOMLAB Optimization Environment provides MATLAB connections to MINOS for large-scale linear programming and Xpress-MP and CPLEX for large-scale linear and integer programming, as well as to these and other codes for a variety of nonlinear programming problems. (See listing under modeling systems below.)
- milp.m, a routine that uses the Optimization Toolbox to solve mixed-integer linear programs.
- LPMEX, an interface to let you run lp_solve from MATLAB.
- MATLAB interfaces to the LOQO and LIPSOL, and MOSEK solvers.
- The MAPLE and Mathematica packages for mathematical computation also provide some linear programming routines; you can get more information by searching at their websites.
Commercial codes and modeling systems
If your models prove to be too difficult for free or add-on software to handle, then you may have to consider acquiring a commercial LP code. Dozens of such codes are on the market. There are many considerations in selecting an LP code. Speed is important, but LP is complex enough that different codes go faster on different models; you won't find a "Consumer Reports" article to say with certainty which code is THE fastest. I usually suggest getting benchmark results for your particular type of model if speed is paramount to you. Benchmarking can also help determine whether a given code has sufficient numerical stability for your kind of models.
Other questions you should answer: Can you use a stand-alone code, or do you need a code that can be used as a callable library, or do you require source code? Do you want the flexibility of a code that runs on many platforms and/or operating systems, or do you want code that's tuned to your particular hardware architecture (in which case your hardware vendor may have suggestions)? Is the choice of algorithm (Simplex, Interior-Point) important to you? Do you need an interface to a spreadsheet code? Is the purchase price an overriding concern? If you are at a university, is the software offered at an academic discount? How much hotline support do you think you'll need? There is usually a large difference in LP codes, in performance (speed, numerical stability, adaptability to computer architectures) and in features, as you climb the price scale.
Information on commercial systems is provided in two tables below. The first lists packages that are primarily algorithmic codes, and the second lists modeling systems. For a more extensive summary, take a look at the Linear Programming Software Survey in the August 1999 issue of OR/MS Today.
In the tables below, product names are linked to product or developer websites where known. Under "Platform" is an indication of common environments in which the code runs, with the choices being Microsoft Windows (PC), Macintosh OS (M), and Unix/Linux (U). The codes under "Features" are as follows:
| S=Simplex | Q=Quadratic |
| B=Barrier | G=General Nonlinear |
| N=Network | I=Integer/Combinatorial |
All product information is subject to change, and some delay may occur before changes are reflected in this table. Consult the products' developers or vendors for definitive information.
| Solver Product | Features | Platform | Phone ( 1) | E-mail address |
| SBI | PC M U | 800-636-5327 | projects@quantumleap.us | |
| SI | PC U | 703-412-3201 | info@ketronms.com | |
| SBINQ | PC U | 800-367-4564 775-831-7744 | info@ilog.com | |
| SBIQ | PC U | 44 18-9525-6484 | info@optirisk-systems.com | |
| HI-PLEX | S | PC U | 44 20-7594-8334 | i.maros@ic.ac.uk |
| SI | PC | 201-627-1424 | info@haverly.com | |
| SI | PC U | 44 20-8877-3030 | info@amsoft.demon.co.uk | |
| SBI | PC U | 312-988-7422 | info@lindo.com | |
| IQG | PC U | 609-258-0876 | rvdb@princeton.edu | |
| SI | PC U | 609-737-6800 | sales@aae.com | |
| SG | PC | 650-856-1695 | info@sbsi-sol-optimize.com | |
| I | U | 404-894-6287 610-758-4879 | martin.savelsbergh@isye.gatech.edu jtl3@lehigh.edu | |
| SBQG | PC M U | 45 3917-9907 | info@mosek.com | |
| SIN | PC U | 703-412-3201 352 5313-2455 | info@ketronms.com rudy@arbed-rech-isdn1.restena.lu | |
| SBINQ | PC U | products@optimize.com | ||
| SINQG | PC M U | 919-677-8000 | ||
| SIQG | PC | 888-831-0333 775-831-0300 | info@frontsys.com | |
| SBIQG | PC U | 732-264-4700 81 3-5966-1220 | sales@saitech-inc.com | |
| SI | PC M U | 626-441-1565 | jim@sunsetsoft.com | |
| SBIQ | PC U | 201-567-9445 44 1604-858993 | info@dashoptimization.com |
| Modeling Product | Platform | Phone ( 1) | E-mail address |
| PC U | +31 23-5511512 +1 (425) 576 4060 +65 9640 4182 | info@aimms.com | |
| PC U | info@ampl.com | ||
| PC | 303-796-7830 | hgreenbe@carbon.cudenver.edu | |
| PC U | 281-584-1945 | info@aspentech.com | |
| PC | 919-859-4101 | vsinfo@vanguardsw.com | |
| PC U | 703-412-3201 | info@ketronms.com | |
| PC | 866-811-4541 418-653-0853 | info@modellium.com | |
| PC U | 202-342-0180 | sales@gams.com | |
| PC U | 800-441-2378 | info@lindo.com | |
| PC U | 33 1-39071240 | info@eurodecision.fr | |
| PC U | |||
| PC U | 301-951-9006 | mathpro@erols.com | |
| PC U | 609-258-3097 | jean@princeton.edu | |
| PC U | 303-796-7830 | hgreenbe@carbon.cudenver.edu | |
| PC | 703-522-7900 | info@maximal-usa.com | |
| PC | 206-521-1008 | info@omatrix.com | |
| PC U | 703-412-3201 | info@ketronms.com | |
| PC U | 973-627-1424 | info@haverly.com | |
| PC | 800-367-4564 775-831-7744 | info@ilog.com | |
| PC | 888-831-0333 775-831-0300 | info@frontsys.com | |
| PC U M | 46 21-804760 530-629-1110 | sales@tomlab.biz us@tomlab.biz | |
| PC U M | 800-441-2378 | info@lindo.com | |
| PC U | 201-567-9445 44 1604-858993 | info@dashoptimization.com |
Free demos of commercial codes
The following commercial LP software developers make demo or academic versions available for downloading through their websites:
- AIMMS with XA and CPLEX
- AMPL with CPLEX and MINOS
- ANALYZE, MODLER and RANDMOD
- C-WHIZ and OML
- LINDO, LINGO and What's Best!
- LOQO with a built-in AMPL interface
- LPL with a built-in solver that can handle a variety of logical as well as linear constraints
- MOSEK API and MATLAB toolbox
- MPL with CPLEX
- OPL Development Studio with CPLEX
- TOMLAB with MINOS, CPLEX, Xpress, and other solvers running from Matlab.
- Xpress-IVE with the Xpress-MP Optimizer and Xpress-Mosel
Typically these versions are limited in the size of problem they accept, or are made available only for "academic use" (mainly research or teaching at universities). Nevertheless, they have most or all of the features of the full versions. All run under recent versions of Microsoft Windows, and some under Linux, Solaris, or other Unix variants; check the relevant web pages for details.
In a number of cases, the developers have also written [#modeling_systems books about these modeling systems]. Demo software with a corresponding book can provide a convenient and inexpensive package for use in teaching or self-study.
Many developers are also willing to arrange for you to "borrow" copies of their full-featured versions for purposes of evaluation. Details vary, however, so you'll have to check with each vendor whose product you're interested in.
Oh, and we also want to solve it as an integer program
Integer LP models are ones whose variables are constrained to take integer or whole number (as opposed to fractional) values. It may not be obvious that integer programming is a very much harder problem than ordinary linear programming, but that is nonetheless the case, in both theory and practice.
Integer models are known by a variety of names and abbreviations, according to the generality of the restrictions on their variables. Mixed integer (MILP or MIP) problems require only some of the variables to take integer values, whereas pure integer (ILP or IP) problems require all variables to be integer. Zero-one (or 0-1 or binary) MIPs or IPs restrict their integer variables to the values zero and one. (The latter are more common than you might expect, because many kinds of combinatorial and logical restrictions can be modeled through the use of zero-one variables.)
For the sake of generality, the following disucssion uses the term MIP to refer to any kind of integer LP problem; the other kinds can be viewed as special cases. MIP, in turn, is a particular member of the class of combinatorial or discrete optimization problems. In fact the problem of determining whether a MIP has an objective value less than a given target is a member of the class of "NP-complete" problems, all of which are very hard to solve (at least as far as anyone has been able to tell). Since any NP-complete problem is reducible to any other, virtually any combinatorial problem of interest can be attacked in principle by solving some equivalent MIP. This approach sometimes works well in practice, though it is by no means infallible.
People are sometimes surprised to learn that MIP problems are solved using floating point arithmetic. Most available general-purpose large-scale MIP codes use a procedure called "branch-and-bound" to search for an optimal integer solution by solving a sequence of related LP "relaxations" that allow some fractional values. Good codes for MIP distinguish themselves primarily by solving shorter sequences of LPs, and secondarily by solving the individual LPs faster. (The similarities between successive LPs in the "search tree" can be exploited to speed things up considerably.) Even more so than with regular LP, a costly commercial code may prove its value if your MIP model is difficult.
Another solution approach known generally as constraint logic programming or constraint programming (CP) has drawn increasing interest of late. Having their roots in studies of logical inference in artificial intelligence, CP codes typically do not proceed by solving any LPs. As a result, compared to branch-and-bound they search "harder" but faster through the tree of potential solutions. Their greatest advantage, however, lies in their ability to tailor the search to many constraint forms that can be converted only with difficulty to the form of an integer program; their greatest success tends to be with "highly combinatorial" optimization problems such as scheduling, sequencing, and assignment, where the construction of an equivalent IP would require the definition of large numbers of zero-one variables. Notable constraint programming codes include CHIP, ECLiPSe, GNU Prolog, IF/Prolog, ILOG Solver, Koalog Constraint Solver, MOzart, and SICStus Prolog. Much more information can be found in the Constraints Archive, which contains the the comp.constraints newsgroup FAQ, pages of constraint-related pointers, source code for various systems, benchmarks, a directory of people interested in constraints, constraint bibliographies, and a collection of on-line papers.
The IP and CP approaches are not so far apart as they may seem, particularly now that each is being adapted to incorporate some of the strengths of the other. Some fundamental connections are described in #Chandru Chandru and Hooker and #Hooker Hooker.
Whatever your solution technique, you should be prepared to devote far more computer time and memory to solving a MIP problem than to solving the corresponding LP relaxation. (Or equivalently, you should be prepared to solve much smaller MIP problems than LP problems using a given amount of computer resources.) To further complicate matters, the difficulty of any particular MIP problem is hard to predict (in advance, at least!). Problems in no more than a hundred variables can be challenging, while others in tens of thousands of variables solve readily. The best explanations of why a particular MIP is difficult often rely on some insight into the system you are modeling, and even then tend to appear only after a lot of computational tests have been run. A related observation is that the way you formulate your model can be as important as the actual choice of solver.
Thus a MIP problem with hundreds of variables (or more) should be approached with a certain degree of caution and patience. A willingness to experiment with alternative formulations and with a MIP code's many search options often pays off in greatly improved performance. In the hardest cases, you may wish to abandon the goal of a provable optimum; by terminating a MIP code prematurely, you can often obtain a high-quality solution along with a provable upper bound on its distance from optimality. A solution whole objective value is within some fraction of 1% of optimal may be all that is required for your purposes. (Indeed, it may be an optimal solution. In contrast to methods for ordinary LP, procedures for MIP may not be able to prove a solution to be optimal until long after they have found it.)
Once one accepts that large MIP models are not typically solved to a proved optimal solution, that opens up a broad area of approximate methods, probabilistic methods and heuristics, as well as modifications to B�B. See [#Balas [Balas]] which contains a useful heuristic for 0-1 MIP models. See also the brief discussion of Genetic Algorithms and Simulated Annealing in the Nonlinear Programming FAQ.
A major exception to this somewhat gloomy outlook is that there are certain models whose LP solution always turns out to be integer, assuming the input data is integer to start with. In general these models have a "unimodular" constraint matrix of some sort, but by far the best-known and most widely used models of this kind are the so-called pure network flow models. It turns out that such problems are best solved by specialized routines, usually based on the simplex method, that are much faster than any general-purpose LP methods. See the section on [#Q6.9 Network models] for further information.
Commercial MIP codes are listed with the [#commercial commercial LP codes] and modeling systems above. The following are notes on some publicly available codes for MIP problems.
- The "free" codes [#free_simplex lp_solve] and [#free_simplex GLPK], mentioned earlier, accept MIP models.
- OPBDP is a C implementation by Peter Barth of an implicit enumeration algorithm for solving linear 0-1 optimization problems. The developer states that the algorithm compares well with commercial linear programming-based branch-and-bound on a variety of standard 0-1 integer programming benchmarks; exploiting the logical structure of a problem, using OPBDP, is said to yield good performance on problems where exploiting the polyhedral structure seems to be inefficient and vice versa.
- I have seen mention made of algorithm 333 in the Collected Algorithms from CACM, though I'd be surprised if it was robust enough to solve large models. I am not aware of this algorithm being available online anywhere.
- In [#Syslo [Syslo]] is code for 28 algorithms, most of which pertain to some aspect of Discrete Optimization.
- Omega analyzes systems of linear equations in integer variables. It does not solve optimization problems, except in the case that a model reduces completely, but its features could be useful in analyzing and reducing MIP models.
I wrote an optimization code. Where are some test models?
If you want to try out your code on some real-world linear programs, there is a very nice collection of small-to-medium-size ones, with a few that are rather large, popularly known as the Netlib collection (although Netlib consists of much more than just LP). Also on netlib is a collection of infeasible LP models. See the readme file for a listing and further information. The test problem files (after you uncompress them) are in a format called [#Q5 MPS], which is described in another section of this document. Note that, when you receive a model, it may be compressed both with the Unix compression utility (use uncompress if the file name ends in .Z) and with an LP-specific program (grab either emps.f or emps.c at the same time you download the model, then compile/run the program to undo the compression).
There is a collection of mixed integer (linear) programming (or MIP) models, called MIPLIB, housed at Rice University.
TSPLIB is a library of traveling salesman and related problems, including vehicle routing problems.
For network flow problems, there are some generators and instances collected at DIMACS. The NETGEN and GNETGEN generator can be downloaded from netlib. Generators and instances for multicommodity network flow problems are maintained by the Operations Research group in the Department of Computer Science at the University of Pisa.
The commercial modeling language GAMS comes with about 160 test models, which you might be able to test your code with. There are also pages containing pointers to numerous examples in AMPL, MPL, and OPL.
There is a collection called MP-TESTDATA available at Konrad-Zuse-Zentrum fuer Informations-technik Berlin (ZIB). This directory contains various subdirectories, each of which has a file named "index" containing further information. Indexed at this writing are: assign, cluster, lp, ip, matching, maxflow, mincost, set-parti, steiner-tree, tsp, vehicle-rout, and generators.
John Beasley of the Imperial College Management School maintains the OR-Library, which lists linear programming and over 3 dozen other categories of optimization test problems.
Finally, Martin Chlond's pages on Integer Programming in Recreational Mathematics provide a variety of challenges for both modelers and software.
What is MPS format?
MPS format was named after an early IBM LP product and has emerged as a de facto standard ASCII medium among most of the commercial LP codes. Essentially all commercial LP codes accept this format, but if you are using public domain software and have MPS files, you may need to write your own reader routine for this. It's not too hard. See also the comment regarding the [#lp_solve lp_solve] code, in another section of this document, for the availability of an MPS reader.
The main things to know about MPS format are that it is column oriented (as opposed to entering the model as equations), and everything (variables, rows, etc.) gets a name. The MIPLIB site provides a concise summary of MPS format, and a more detailed description is given in [#Murtagh [Murtagh]].
MPS is a very old format, so it is set up as though you were using punch cards, and is not free format. Fields start in column 1, 5, 15, 25, 40 and 50. Sections of an MPS file are marked by so-called header cards, which are distinguished by their starting in column 1. Although it is typical to use upper-case throughout the file (like I said, MPS has long historical roots), many MPS-readers will accept mixed-case for anything except the header cards, and some allow mixed-case anywhere. The names that you choose for the individual entities (constraints or variables) are not important to the solver; you should pick names that are meaningful to you, or will be easy for a post-processing code to read.
Here is a little sample model written in MPS format (explained in more detail below):
NAME TESTPROB
ROWS
N COST
L LIM1
G LIM2
E MYEQN
COLUMNS
XONE COST 1 LIM1 1
XONE LIM2 1
YTWO COST 4 LIM1 1
YTWO MYEQN -1
ZTHREE COST 9 LIM2 1
ZTHREE MYEQN 1
RHS
RHS1 LIM1 5 LIM2 10
RHS1 MYEQN 7
BOUNDS
UP BND1 XONE 4
LO BND1 YTWO -1
UP BND1 YTWO 1
ENDATA
For comparison, here is the same model written out in an equation-oriented format:
Optimize
COST: XONE 4 YTWO 9 ZTHREE
Subject To
LIM1: XONE YTWO { = 5
LIM2: XONE ZTHREE } = 10
MYEQN: - YTWO ZTHREE = 7
Bounds
0 { = XONE { = 4
-1 { = YTWO { = 1
End
Strangely, there is nothing in MPS format that specifies the direction of optimization. And there really is no standard "default" direction; some LP codes will maximize if you don't specify otherwise, others will minimize, and still others put safety first and have no default and require you to specify it somewhere in a control program or by a calling parameter. If you have a model formulated for minimization and the code you are using insists on maximization (or vice versa), it may be easy to convert: just multiply all the coefficients in your objective function by (-1). The optimal value of the objective function will then be the negative of the true value, but the values of the variables themselves will be correct.
The NAME card can have anything you want, starting in column 15. The ROWS section defines the names of all the constraints; entries in column 2 or 3 are E for equality rows, L for less-than (
) rows, G for greater-than (
) rows, and N for non-constraining rows (the first of which would be interpreted as the objective function). The order of the rows named in this section is unimportant.
The largest part of the file is in the COLUMNS section, which is the place where the entries of the A-matrix are put. All entries for a given column must be placed consecutively, although within a column the order of the entries (rows) is irrelevant. Rows not mentioned for a column are implied to have a coefficient of zero.
The RHS section allows one or more right-hand-side vectors to be defined; most people don't bother having more than one. In the above example, the name of the RHS vector is RHS1, and has non-zero values in all 3 of the constraint rows of the problem. Rows not mentioned in an RHS vector would be assumed to have a right-hand-side of zero.
The optional BOUNDS section lets you put lower and upper bounds on individual variables, instead of having to impose bounds through extra rows in the matrix. All the bounds that have a given name in column 5 are taken together as a set. Variables not mentioned in a given BOUNDS set are taken to be non-negative (lower bound zero, no upper bound). A bound of type UP means an upper bound is applied to the variable. A bound of type LO means a lower bound is applied. A bound type of FX ("fixed") means that the variable has upper and lower bounds equal to a single value. A bound type of FR ("free") means the variable has neither lower nor upper bounds.
There is another optional section called RANGES that specifies double-inequalities, in a somewhat counterintuitive way; I won't try to give a description here. There are also some ways to mark integer variables. The final card must be ENDATA, and yes, it is spelled funny.
There are a few special cases of the MPS "standard" that are not consistently handled by implementations. In the BOUNDS section, if a variable is given a nonpositive upper bound but no lower bound, its lower bound may default to zero or to minus inifinity. If an integer variable has no upper bound specified, its upper bound may default to one rather than to plus infinity.
Topics briefly covered
What is a modeling language?
There is more to linear programming (or integer programming) than optimal solutions and number-crunching. This can be appreciated by observing that modern LP software comes in two related but very different kinds of packages:
- Algorithmic codes are devoted to finding optimal solutions to specific linear programs. A code takes as input a compact listing of the LP constraint coefficients (the A, b, c and related values in the [#Q1 standard form]) and produces as output a similarly compact listing of optimal solution values and related information.
- Modeling systems are designed to help people formulate LPs and analyze their solutions. An LP modeling system takes as input a description of a linear program in a form that people find reasonably natural and convenient, and allows the solution output to be viewed in similar terms; conversion to the forms requried by algorithmic codes is done automatically. The collection of statement forms for the input is often called a modeling language.
Most modeling systems support a variety of algorithmic codes, while the more popular codes can be used with many different modeling systems. Because packages of the two kinds are often bundled for convenience of marketing or operation, the distinction between them is sometimes obscured, but it is important to keep in mind when sorting through the many possibilities. See under [#commercial Commercial Codes and Modeling Systems] elsewhere in this FAQ for a list of modeling systems available. There are no free ones of note, but many do offer [#freedemos free demo versions].
Common alternatives to modeling languages and systems include spreadsheet front ends to optimization, and custom optimization applications written in general-purpose programming languages. You can find a discussion of the pros and cons of these approaches in What Modeling Tool Should I Use? on the Frontline Systems website.
How do I diagnose an infeasible LP model?
A linear program is infeasible if there exists no solution that satisfies all of the constraints -- in other words, if no feasible solution can be constructed. Since any real operation that you are modeling must remain within the constraints of reality, infeasibility most often indicates an error of some kind. Simplex-based LP software efficiently detects when no feasible solution is possible; some early interior-point codes could not detect an infeasible situation as reliably, but remedies for this flaw have been introduced.
The source of infeasibility is often difficult to track down. It may stem from an error in specifying some of the constraints in your model, or from some wrong numbers in your data. It can be the result of a combination of factors, such as the demands at some customers being too high relative to the supplies at some warehouses.
Upon detecting infeasibility, LP codes typically show you the most recent infeasible solution that they have encountered. Sometimes this solution provides a good clue as to the source of infeasibility. If it fails to satisfy certain capacity constraints, for example, then you would do well to check whether the capacity is sufficient to meet the demand; perhaps a demand number has been mistyped, or an incorrect expression for the capacity has been used in the capacity constraint, or or the model simply lacks any provision for coping with increasing demands. More often, unfortunately, LP codes respond to an infeasible problem by returning a meaninglessly infeasible solution, such as one that violates material balances.
A more useful approach is to forestall meaningless infeasibilities by explicitly modeling those sources of infeasibility that you view as realistic. As a simple example, you could add a new "slack" variable on each capacity constraint, having a very high penalty cost. Then infeasibilities in your capacities would be signalled by positive values for these slacks at the optimal solution, rather than by a mysterious lack of feasibility in the linear program as a whole. Many modelers recommend the use of "soft constraints" of this kind in all models, since in reality many so-called constraints can be violated for a sufficiently high price. Modeling approaches that use such constraints have a number of names, most notably "goal programming" and "elastic programming".
I want to know the specific constraints that contradict each other
There can be many ways to answer this question, some of them potentially harder than solving the underlying LP would be (if it were feasible). One useful appoach is to apply auxiliary algorithms that look for small groups of constraints that can be considered to "cause" the infeasibility of the LP.
Several codes include methods for finding an "irreducible infeasible subset" (IIS) of constraints that has no feasible solution, but that becomes feasible if any one constraint is removed. John Chinneck has developed MINOS(IIS), an extended version of the MINOS package that finds an IIS when the constraints have no feasible solution; a demonstration copy is available for downloading. There are also IIS finders in CPLEX, LINDO, OSL, and Xpress-MP, as well as Premium Solver Platform for Excel.
Methods also exist for finding an "IIS cover" that has at least one constraint in every IIS. A minimal IIS cover is the smallest subset of constraints whose removal makes the linear program feasible. Further details and references for a variety of IIS topics are available in papers by John Chinneck.
The software system ANALYZE carries out various other analyses to detect structures typically associated with infeasibility. (A bibliography on optimization modeling systems collected by Harvey Greenberg of the University of Colorado at Denver contains cross-references to over 100 papers on the subject of model analysis.)
I just want to know whether or not a feasible solution exists
From the standpoint of computational complexity, finding out if an LP model has a feasible solution is essentially as hard as actually finding the optimal LP solution, within a factor of 2 on average, in terms of effort in the Simplex Method; plug your problem into a normal LP solver with any objective function you like, such as c=0. For MIP models, it's also difficult - if there exists no feasible solution, then you must go through the entire Branch and Bound procedure (or whatever algorithm you use) to prove this. There are no shortcuts in general, unless you know something useful about your model's structure (e.g., if you are solving some form of a transportation problem, you may be able to assure feasibility by checking that the sources add up to at least as great a number as the sum of the destinations).
I have an LP, except it's got several objective functions
If you have several objectives, then you may find that they cannot all be optimized by any one solution. Instead, you will need to look for a solution or solutions that achieve an acceptable tradeoff between objectives. Deciding what tradeoffs are "acceptable" is a topic of investigation in its own right. You may want to consult MCDM WorldScan, the newsletter of the International Society on Multiple Criteria Decision Making.
There are a few free software packages specifically for multiple objective linear programming, including:
- ADBASE computes all efficient (i.e., nondominated) extreme points of a multiple objective linear program. It is available without charge for research and instructional purposes. If someone has a genuine need for such a code, they should send a request to: Ralph E. Steuer, Faculty of Management Science, Brooks Hall, University of Georgia, Athens, GA 30602-6255.
- PROTASS, developed by Rafal Cytrycki (rcytrycki@computerland.pl) and Andrzej Dzik (andrzej.dzik@ekspert.szczecin.pl), provides two methods for multicriteria optimization: STEM and HSJ.
- NIMBUS is an interactive multiobjective optimization system that has a Web interface.
Other approaches that have worked are:
- Goal Programming (treat the objectives as constraints with costed slacks), or, almost equivalently, form a composite function from the given objective functions;
- Pareto preference analysis (essentially brute force examination of all vertices);
- Put your objective functions in priority order, optimize on one objective, then change it to a constraint fixed at the optimal value (perhaps subject to a small tolerance), and repeat with the next function.
There is a section on this whole topic in [#Nemhauser [Nemhauser]]. [#Schrage [Schrage]] has a chapter devoted to the subject. [#Hwang [Hwang]] has also been recommended by a reader on Usenet. As a final piece of advice, if you can cast your model in terms of physical realities, or dollars and cents, sometimes the multiple objectives disappear! 8v)
I have an LP that has large almost-independent matrix blocks that are linked by a few constraints. Can I take advantage of this?
Possibly you could solve your LP faster by using some form of decomposition scheme; see for example section 6.2 in #Nemhauser Nemhauser or chapter 26 of #Chvatal Chvatal. The commercial code OSL has features to assist in decomposing so-called Dantzig-Wolfe and staircase structures. With any other code, you'll have to create your own decomposition framework and then call an LP solver to handle the subproblems.
The folklore is that generally decomposition schemes take a long time to converge, so that they're slower than just solving the model as a whole -- although research continues. For now my advice, unless you are using OSL or your model is so huge that you can't buy enough memory to hold it, is to not bother decomposing it. It's probably more cost effective to upgrade your solver than to invest more time in programming (a good piece of advice in many situations).
I am looking for an algorithm to compute the convex hull of a finite number of points in n-dimensional space
A good place to start is the directory of Codes for Polytope and Polyhedron Algorithms at the Konrad-Zuse-Zentrum f�r Informationstechnik Berlin. It includes codes for convex hull computation, as well as for the opposite problem of generating all extreme points and extreme rays of a general convex polyhedron given by a system of linear inequalities. Here are further comments on some of these codes:
Ken Clarkson has written Hull, an ANSI C program that computes the convex hull of a point set in general dimension. The input is a list of points, and the output is a list of facets of the convex hull of the points, each facet presented as a list of its vertices.
Qhull computes convex hulls as well as Delaunay triangulations, halfspace intersections about a point, Voronoi diagrams, and related objects. It uses the "Beneath Beyond" method, described in [#Edelsbrunner [Edelsbrunner]].
Komei Fukuda's cdd solves both the convex hull and vertex enumeration problems, using the Double Description Method of Motzkin et al. There are also a C version (cdd ) and a C-library version (cddlib) that can be compiled to run with both floating-point and GMP exact rational arithmetics.
David Avis's lrslib is a self-contained ANSI C implementation of the reverse search algorithm for vertex enumeration/convex hull problems, implemented as a callable library with a choice of three arithmetic packages. VE041, another implementation of this approach by Fukuda and Mizukoshi, is available in a Mathematica implementation.
See also the directory of computational geometry software compiled by Nina Amenta; and the archive of the former University of Minnesota Geometry Center website, which includes links to downloadable software.
Other algorithms for such problems are described in [#Swart [Swart]], [#Seidel [Seidel]], and [#Avis [Avis]]. Such topics are said to be discussed in [#Schrijver [Schrijver]] (page 224), [#Chvatal [Chvatal]] (chapter 18), [#Balinski [Balinski]], and [#Mattheis [Mattheis]] as well.
Are there any parallel LP codes?
Options for parallel computation of various kinds have become a common feature of software for linear and mixed-integer programming. Here are some examples:
- IBM's OSL Parallel Extensions implement interior-point methods for linear programming and branch-and-bound methods for mixed-integer programming on homogeneous networks under Windows NT, AIX 4.x (on IBM RS/6000 and SP systems), HP-UX, Sun Solaris, and SGI IRIX, using the Parallel Virtual Machine (PVM) System version 3.4 for communication.
- The CPLEX Parallel Solvers include simplex, barrier, and branch-and-bound solvers for linear and mixed-integer programming on a number of multiple-CPU systems.
- Dash's Xpress-Parallel includes a branch-and-bound mixed-integer programming code designed to exploit both multi-processor computers and networks of workstations.
- OOPS is an object-oriented parallel implementation of the interior point algorithm, developed by Jacek Gondzio (gondzio@maths.ed.ac.uk), Andreas Grothey and Robert Sarkissian. The code can exploit any special structure of the problem. It runs on all parallel computing platforms that support MPI.
Two parallel branch-cut-price frameworks are available to those who want to program specialized solvers for hard combinatorial problems that can be approached via integer programming:
- Symphony requires the user to supply model-specific preprocessing and separation functions, while other components including search tree, cut pool, and communication management are handled internally. Source code is included for basic applications to traveling salesman and vehicle routing problems. The distributed version runs in any environment supported by the PVM message passing protocol, and can also be compiled for shared-memory architectures using any OpenMP compliant compiler.
- BCP is a component of the COIN open source initiative.
Performance evaluations of parallel solvers must be interpreted with care. One common measurement is the "speedup" defined as the time for solution using a single processor divided by the time using multiple processors. A speedup close to the number of processors is ideal in some sense, but it is only a relative measure. The greatest speedups tend to be achieved by the least efficient codes, and especially by those that fail to take advantage of the sparsity (predominance of zero coefficients) in the constraints. For problems having thousands of constraints, a sparse single-processor code will tend to be faster than a non-sparse multiprocessor code running on current-day hardware.
What software is there for Network models?
In the context of linear programming, the term "network" is most often associated with the minimum-cost network flow problem. A network for this problem is viewed as a collection of nodes (or circles or locations) and arcs (or lines or routes) connecting selected pairs of nodes. Arcs carry a physical or conceptual flow of some kind, and may be directed (one-way) or undirected (two-way). Some nodes may be sources (permitting flow to enter the network) or sinks (permitting flow to leave).
The network linear programming problem is to minimize the (linear) total cost of flows along all arcs of a network, subject to conservation of flow at each node, and upper and/or lower bounds on the flow along each arc. This is a special case of the general linear programming problem. The transportation problem is an even more special case in which the network is bipartite: all arcs run from nodes in one subset to the nodes in a disjoint subset. A variety of other well-known network problems, including shortest path problems, maximum flow problems, and certain assignment problems, can also be modeled and solved as network linear programs. Details are presented in many [#Q7 books on linear programming] and operations research.
Network linear programs can be solved 10 to 100 times faster than general linear programs of the same size, by use of specialized optimization algorithms. Some commercial LP solvers include a version of the network simplex method for this purpose. That method has the nice property that, if it is given integer flow data, it will return optimal flows that are integral. Integer network LPs can thus be solved efficiently without resort to complex integer programming software.
Unfortunately, many different network problems of practical interest do not have a formulation as a network LP. These include network LPs with additional linear "side constraints" (such as multicommodity flow problems) as well as problems of network routing and design that have completely different kinds of constraints. In principle, nearly all of these network problems can be modeled as integer programs. Some "easy" cases can be solved much more efficiently by specialized network algorithms, however, while other "hard" ones are so difficult that they require specialized methods that may or may not involve some integer programming. Contrary to many people's intuition, the statement of a hard problem may be only marginally more complicated than the statement of some easy problem.
A canonical example of a hard network problem is the "[#Q6.10 traveling salesman]" problem of finding a shortest tour through a network that visits each node once. A canonical easy problem not obviously equivalent to a linear program is the "minimum spanning tree" problem to find a least-cost collection of arcs that connect all the nodes. But if instead you want to connect only some given subset of nodes (the "Steiner tree" problem) then you are faced with a hard problem. These and many other network problems are described in some of the [#Q7 references] below.
Software for network optimization is thus in a much more fragmented state than is general-purpose software for linear programming. The following are some of the implementations that are available for downloading. Most are freely available for many purposes, but check their web pages or "readme" files for details.
- ASSCT, an implementation of the Hungarian Method for the Assignment problem (#548 from Collected Algorithms of the ACM).
- GIDEN, an interactive graphical environment for a variety of network problems and algorithms, available as a Java application or as an applet that can be executed through any Java-enabled Web browser. Further information is available by writing to giden@iems.northwestern.edu.
- MCF, a C implementation of primal and dual network simplex methods (from Andreas Loebel, loebel@zib.de), supported for Unix/Linux environments and Windows 95/98/NT (MS Visual C 6.0), and available for academic use free of charge.
- Netflo, the Fortran network simplex code from [#Kennington [Kennington]], and several codes for maximum matching and maximum flow problems (from DIMACS, help@dimacs.rutgers.edu)
- PPRN, for single or multicommodity network flow problems having a linear or nonlinear objective function, optionally with linear side constraints, by Jordi Castro (jcastro@eio.upc.es)
- RELAX-IV for minimum-cost network flows (by Dimitri Bertsekas, bertsekas@lids.mit.edu and Paul Tseng, tseng@math.washington.edu); also a C version of the RELAX-IV algorithm (at the Department of Computer Science, University of Pisa, frangio@di.unipi.it)
The following indexes may also be useful:
- Network optimization codes in Fortran 77 and in C, compiled by Ernesto Martins (eqvm@mat.uc.pt)
- The network optimization library, including codes for assignment, shortest path, minimum-cost flow, and maximum flow/minimum cut, by Andrew Goldberg (avg@research.nj.nec.com).
- Optimization routines for optimization networks and theory graphs in the listing of public-domain optimization codes maintained by Jiefeng Xu (Jiefeng.Xu@Colorado.edu).
- Network optimization listings from the NEOS Guide.
Fortran code for the Assignment Problem and others can also be copied from[#Burkard [Burkard]] and from [#Martello [Martello]].
What software is there for the Traveling Salesman Problem?
This famously hard problem -- known more briefly as the TSP -- is to find the shortest tour that visits a given collection of cities or locations of some kind. It is a hard (NP-complete) problem just like [#Q3 integer programming], but the obvious integer programming formulations of it are not especially useful in getting good solutions within a reasonable amount of time.
The TSP has attracted many of the best minds in the optimization field, and serves as a kind of test-bed for methods subsequently applied to more complex and practical problems. Methods have been explored both to give proved optimal solutions, and to give approximate but "good" solutions, with a number of codes being developed as a result:
- Concorde has solved a number of the largest TSPs for which proved optimal solutions are known. It employs a polyhedral approach, which is to say that it relies on a range of exceedingly sophisticated linear programming constraints, in a framework that resembles integer programming branch-and-bound methods. The constraints are selectively generated as the solution process proceeds. The full C code is available without cost for research purposes.
- Public domain code for the Asymmetric TSP (with travel between two cities significantly cheaper in one of the two directions) is available in TOMS routine #750, documented in [#Carpaneto [Carpaneto]].
- Code for a solver can be obtained via instructions in [#Volgenant [Volgenant]].
- Chad Hurwitz, offers a code called tsp_solve for heuristic and optimal solution, to those who email him.
- [#Syslo [Syslo]] contains some algorithms and Pascal code.
- Numerical Recipes [#Press [Press]] contains code that uses simulated annealing.
- Stephan Mertens's TSP Algorithms in Action uses Java applets to illustrate some simple heursitics and compare them to optimal solutions, on 10-25 node problems.
- Onno Waalewijn has constructed Java TSP applets exhibiting the behavior of different methods for heuristic and exhaustive search on various test problems.
For a bibliography, check the Integer Programming section of [#Nemhauser [Nemhauser]], particularly the references with the names Groetschel and/or Padberg in them. Other good references are [#Lawler [Lawler]] and [#Reinelt [Reinelt]]. Sophisticated and widely used heuristics for getting a "good" solution are described in the article by Lin and Kernighan in Operations Research 21 (1973) 498-516.
For practical purposes, the traveling salesman problem is only the simplest case of what are generally known as vehicle-routing problems. Thus commercial software packages for vehicle routing -- or more generally for "supply chain management" or "logistics" -- may have TSP routines buried somewhere within them. OR/MS Today published a detailed vehicle routing software survey in their August 2000 issue.
What software is there for cutting or packing problems?
The cutting (or "cutting stock") problem involves cutting large pieces of something into specified numbers of smaller pieces in the most economical way. In the one-dimensional version, cutting only reduces a single measurement, usually referred to as the length or width of the pieces; examples include cutting wide rolls of paper or sheet steel into specified numbers of smaller widths (also called the "roll trim" problem), and cutting long pieces of wood or pipe into specified specified numbers of shorter pieces. In the two-dimensional version, both a length and width may be specified for both the large pieces you start with and the smaller ones to be cut, or the shapes to be cut may be more general. The material may again be wood or metal, or paper or fabric, or even cookie dough.
The packing problem can be regarded as a kind of cutting in reverse, where the goal is to fill large spaces with specified smaller pieces in the most economical (or profitable) way. As with cutting, there are one-dimensional problems (also called knapsack problems) and two-dimensional problems, but there are also many three-dimensional cases such as arise in filling trucks or shipping containers. The size measure is not always length or width; it may be weight, for example.
Except for some very special cases, cutting and packing problems are hard (NP-complete) like [#Q3 integer programming] or the [#Q6.10 TSP]. The simpler one-dimensional instances are often not hard to solve in practice, however:
- For knapsack problems, a good MIP solver applied to a straightforward integer-programming formulation can often be used. Specialized algorithms are said to be available in #Syslo Syslo and [#Martello [Martello]].
- For roll-trim problems, it is not hard to implement the Gilmore-Gomory procedure using a linear programming subroutine library or modeling language. The NEOS Guide's cutting stock case study introduces this procedure and lets you try small examples, while a good detailed presentation can be found in chapter 13 of #Chvatal Chvatal). This approach is based on a linear programming problem that decides how many rolls should be cut in each of several patterns, which means that fractional numbers of patterns may show up in the results. As long as most widths are needed in substantial quantities -- say, 10 or more -- an acceptable result can usually be found by rounding the fractions, or by solving one integer program at the end of the procedure.
One-dimensional problems that are subject to additional special requirements can be much harder, though; see #Haessler Haessler for some examples in the roll-trim context. Higher-dimensional problems tend to be much harde