| > Continuous Optimization > Solving LPs: Simplex Optimizers > Example: Using a Starting Basis in an LP Problem |
Example: Using a Starting Basis in an LP Problem |
INDEX
PREVIOUS
NEXT
|
Here is an approach mentioned in the section Tuning LP Performance, which is to start with an advanced basis. The following small example demonstrates an approach to setting a starting basis by hand.
The example, ilolpex6.cpp, resembles one you may have studied in the ILOG CPLEX Getting Started manual, ilolpex1.cpp. This example differs from that one in these ways:
populatebycolumn method, and thus no command line arguments are needed to select a construction method.
main routine, the arrays cstat and rstat set the status of the initial basis.
cplex.setBasisStatuses.
The main program starts by declaring the environment and terminates by calling method end for the environment. The code in between is encapsulated in a try block that catches all Concert Technology exceptions and prints them to the C++ error stream cerr. All other exceptions are caught as well, and a simple error message is issued. Next the model object and the cplex object are constructed. The function populatebycolumn builds the problem object and, as noted earlier, cplex.setBasisStatuses copies the advanced starting basis.
The call to cplex.solve optimizes the problem, and the subsequent print of the iteration count demonstrates that the advanced basis took effect. In fact, this basis is immediately determined to be the optimal one, resulting in zero iterations being performed, in contrast to the behavior seen in the example program ilolpex1.cpp where the same model is solved without the use of an advanced basis.
The complete program, ilolpex6.cpp, appears here and online in the standard distribution
| Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |