Using callbacks
These callback routines interrupt and resume optimization; they also access progress information while the optimization is in process.
Interrupt routines, also known as callback routines, allow users to define functions to interrupt and resume optimization and to access progress information while the optimization is in process.
CPLEX provides these kinds of callbacks:
-
Informational callbacks to access information about the progress of optimization without interfering with the search path; also useful to terminate optimization; compatible with dynamic search; compatible with all modes of parallel optimization.
-
Query callbacks, also known as diagnostic callbacks, to access information in the course of optimization; incompatible with dynamic search; incompatible with deterministic parallel optimization by default; for a means to force deterministic parallel optimization, see the parallel mode switch (ParallelMode, CPX_PRAM_PARALLELMODE) in the CPLEX Parameters Reference Manual.
-
Control callbacks to change the search path, for example, by interrupting and resuming optimization under conditions specified by the user; incompatible with dynamic search; incompatible with deterministic parallel optimization by default; for a means to force deterministic parallel optimization, see the parallel mode switch (ParallelMode, CPX_PRAM_PARALLELMODE) in the CPLEX Parameters Reference Manual.
For a detailed explanation of each type of callback, see Using legacy optimization callbacks in the CPLEX User's Manual, as well as the documentation of routines, classes, and methods in the reference manual of each application programming interface (API).
Names of classes, methods, and symbolic constants in the C#.NET API correspond very closely to those in the Java API with these systematic exceptions:
-
In the Java API, the names of classes begin with the prefix Ilo, whereas in C#.NET they do not.
-
In the Java API, the names of methods conventionally begin with a lowercase letter, for example,
addCols, whereas in the C#.NET API, the names of methods conventionally begin with an uppercase (that is, capital) letter, for example,AddColsaccording to Microsoft practice.
| Purpose | Java API | C++ API | C API |
|---|---|---|---|
| Gets function to be called during LP optimization | ---- | ---- |
CPXXgetlpcallbackfunc and CPXgetlpcallbackfunc
|
| Sets function to be called during LP optimization | IloCplex. use | IloCplex:: use |
CPXXsetlpcallbackfunc and CPXsetlpcallbackfunc
|
| Gets function to be called during MIP optimization | ---- | ---- |
CPXXgetmipcallbackfunc and CPXgetmipcallbackfunc
|
| Sets function to be called during MIP optimization | IloCplex. use | IloCplex:: use |
CPXXsetmipcallbackfunc and CPXsetmipcallbackfunc
|
| Gets function to be called during network optimization | ---- | ---- |
CPXXgetnetcallbackfunc and CPXgetnetcallbackfunc
|
| Sets function to be called during network optimization | IloCplex. use | IloCplex:: use |
CPXXsetnetcallbackfunc and CPXsetnetcallbackfunc
|
| Gets optimization progress information | Methods of callback classes | Methods of callback classes |
CPXXgetcallbackinfo and CPXgetcallbackinfo
|