ILOG CPLEX 11.0 User's Manual > Continuous Optimization > Solving LPs: Simplex Optimizers > Examples: Using a Starting Basis in an LP Problem > Example ilolpex6.cpp

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:

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 detected as optimal, 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 online in the standard distribution at yourCPLEXinstallation/examples/src.