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::getStartTimereturns a time stamp in seconds at the beginning of optimization.CallbackI::getStartDetTimereturns a time stamp in deterministic ticks at the beginning of optimization.CallbackI::getEndTimereturns a time stamp specifying in seconds when CPLEX will reach a time limit.CallbackI::getEndDetTimereturns a time stamp specifying in deterministic ticks when CPLEX will reach a time limit.CallbackI::getCplexTimereturns the current time stamp in seconds.CallbackI::getDetTimereturns the current time stamp in deterministic ticks.In the Java API,
CpxCallback.getStartTimereturns a time stamp in seconds at the beginning of optimization.CpxCallback.getStartDetTimereturns a time stamp in deterministic ticks at the beginning of optimization.CpxCallback.getEndTimereturns a time stamp specifying in seconds when CPLEX will reach a time limit.CpxCallback.getEndDetTimereturns a time stamp specifying in deterministic ticks when CPLEX will reach a time limit.In the .NET API, the property
Cplex.Callback.StartTimeaccesses a time stamp in seconds at the beginning of optimization.Cplex.Callback.StartDetTimeaccesses a time stamp in deterministic ticks at the beginning of optimization.Cplex.Callback.EndTimeaccesses a time stamp specifying in seconds when CPLEX will reach a time limit.Cplex.Callback.EndDetTimeaccesses 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_STARTTIMEandCPX_CALLBACK_INFO_ENDTIMEare symbolic values thatCPXgetcallbackinfocan supply in its argumentwhichinfo. 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_STARTDETTIMEandCPX_CALLBACK_INFO_ENDDETTIMEare also symbolic values thatCPXgetcallbackinfocan supply in its argumentwhichinfo. 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