Using the timing interface in callbacks

Describes the timing interface for accessing time stamps from callbacks.

In addition to the general purpose methods and routines that provide a time stamp to enable you to measure computational time in your applications of IBM ILOG CPLEX, there are methods and routines specifically for use in callbacks. Like the general purpose methods and routines for time stamps, these callback methods and routines are adapted for use either with the default opportunistic search or with the deterministic search. An application can invoke one of these methods or routines at the beginning and end of an operation, and then compare the two time stamps to compute elapsed time (either in seconds or in deterministic ticks, respectively).

  • In Concert Technology

    • In the C++ API, CallbackI::getStartTime returns a time stamp in seconds at the beginning of optimization. CallbackI::getStartDetTime returns a time stamp in deterministic ticks at the beginning of optimization. CallbackI::getEndTime returns a time stamp specifying in seconds when CPLEX will reach a time limit. CallbackI::getEndDetTime returns a time stamp specifying in deterministic ticks when CPLEX will reach a time limit. CallbackI::getCplexTime returns the current time stamp in seconds. CallbackI::getDetTime returns the current time stamp in deterministic ticks.

    • In the Java API, CpxCallback.getStartTime returns a time stamp in seconds at the beginning of optimization. CpxCallback.getStartDetTime returns a time stamp in deterministic ticks at the beginning of optimization. CpxCallback.getEndTime returns a time stamp specifying in seconds when CPLEX will reach a time limit. CpxCallback.getEndDetTime returns a time stamp specifying in deterministic ticks when CPLEX will reach a time limit.

    • In the .NET API, the property Cplex.Callback.StartTime accesses a time stamp in seconds at the beginning of optimization. Cplex.Callback.StartDetTime accesses a time stamp in deterministic ticks at the beginning of optimization. Cplex.Callback.EndTime accesses a time stamp specifying in seconds when CPLEX will reach a time limit. Cplex.Callback.EndDetTime accesses a time stamp specifying in deterministic ticks when CPLEX will reach a time limit.

    With those values, you can compute the time in seconds since the start of the optimization: getCplexTime - getStartTime. Likewise, you can compute the remaining time in seconds until CPLEX reaches the time limit: getEndTime - getCplexTime. Analogously, you can compute the time in deterministic ticks since the start of the optimization: getDetTime - getStartDetTime. Similarly, you can compute the remaining time in deterministic ticks until CPLEX reaches the time limit: getDetEndTime - getDetTime.

  • In the Callable Library, CPX_CALLBACK_INFO_STARTTIME and CPX_CALLBACK_INFO_ENDTIME are symbolic values that CPXgetcallbackinfo can supply in its argument whichinfo. Those values are time stamps of the point in time when optimization started and terminated (if optimization does not finish before that point). In other words, those symbols are useful in measuring time in seconds through information callbacks.

    Likewise, CPX_CALLBACK_INFO_STARTDETTIME and CPX_CALLBACK_INFO_ENDDETTIME are also symbolic values that CPXgetcallbackinfo can supply in its argument whichinfo. Those values are time stamps of the point in time measured in deterministic ticks when optimization started and terminated (if optimization does not finish before that point). In other words, those symbols are useful in measuring time in deterministic ticks through information callbacks.

  • In the Python API, these methods are available for measuring time in callbacks.
    • Callback.get_start_time
    • Callback.get_start_dettime
    • Callback.get_end_time
    • Callback.get_end_dettime
    • Callback.get_dettime