Example: Reading a QP from a File

This example shows you how to optimize a QP with routines from the ILOG CPLEX Callable Library when the problem data is stored in a file. The example derives from lpex2.c, described in the manual ILOG CPLEX Getting Started.

This example differs from lpex2.c in its command line. In qpex2.c, there is no need of a command-line argument to indicate which optimizer to call, as only the ILOG CPLEX Barrier Optimizer is used to solve QPs. In other words, this example always calls the routine CPXbaropt().

This example also differs in the way it shows a solution. Since no basis is available for the QP, this example calls the routine CPXgetx() to get a solution. It is, however, possible to call CPXsolution() to get a primal and dual solution to the problem.

Like other applications based on the ILOG CPLEX Callable Library, this one begins with calls to CPXopenCPLEX() to initialize the ILOG CPLEX environment and to CPXcreateprob() to create the problem object. Before it ends, it frees the problem object with a call to CPXfreeprob(), and it frees the environment with a call to CPXcloseCPLEX().


Previous Page: Example: qpex1.c  Return to Top Next Page: Complete Program: qpex2.c