12.07.2015 Views

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

ILOG CPLEX 11.0 User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The complete program, ilolpex4.cpp, appears online in the standard distribution atyour<strong>CPLEX</strong>installation/examples/src. In the same location, there are also samplesin Java (LPex4.java) and in the .NET API (LPex4.cs and LPex4.vb).Implementing Callbacks in the Callable Library<strong>ILOG</strong> <strong>CPLEX</strong> optimization routines in the Callable Library incorporate a callback facility toallow your application to transfer control temporarily from <strong>ILOG</strong> <strong>CPLEX</strong> to the callingapplication. Using callbacks, your application can implement interrupt capability, forexample, or create displays of optimization progress. After control is transferred back to afunction in the calling application, the calling application can retrieve specific informationabout the current optimization from the routine CPXgetcallbackinfo. Optionally, thecalling application can then tell <strong>ILOG</strong> <strong>CPLEX</strong> to discontinue optimization.To implement and use a callback in your application, you must first write the callbackfunction and then tell <strong>ILOG</strong> <strong>CPLEX</strong> about it. For more information about the <strong>ILOG</strong> <strong>CPLEX</strong>Callable Library routines for callbacks, see the <strong>ILOG</strong> <strong>CPLEX</strong> Callable Library Reference<strong>Manual</strong>. In that reference manual, the group optim.cplex.callable.callbacks givesyou direct access to callback routines.Setting CallbacksIn the Callable Library, query or diagnostic callbacks are organized into two groups: LPcallbacks (that is, continuous callbacks) and MIP callbacks (that is, discrete callbacks). Foreach group, one callback function can be set by the routine CPXsetlpcallbackfunc andone by CPXsetmipcallbackfunc. You can distinguish between the actual callbacks byquerying the argument wherefrom passed to the callback function as an argument by<strong>ILOG</strong> <strong>CPLEX</strong>.The continous callback is also called during the solution of problems of type LP, QP, andQCP.Callbacks for Continuous and Discrete Problems<strong>ILOG</strong> <strong>CPLEX</strong> will evaluate two user-defined callback functions, one during the solution ofcontinuous problems and one during the solution of discrete problems. <strong>ILOG</strong> <strong>CPLEX</strong> callsthe continuous callback once per iteration during the solution of an LP, QP, or QCP problemand periodically during the presolve. <strong>ILOG</strong> <strong>CPLEX</strong> calls the discrete callback periodicallyduring the probing phase of MIP preprocessing, periodically during cut generation, andperiodically in the branch & cut process.Every user-defined callback must have these arguments:◆env, a pointer to the <strong>ILOG</strong> <strong>CPLEX</strong> environment;460 <strong>ILOG</strong> <strong>CPLEX</strong> <strong>11.0</strong> — USER’ S MANUAL

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!