public abstract static class IloCplex.Callback
extends java.lang.Object
implements java.lang.Cloneable
This class defines the common interface available to all callback classes. A
callback is an object with a method main implemented by the
user. This method is called by the IloCplex algorithm at
specific points during the optimization. For each of these points, an
extension of IloCplex.Callback is provided. To implement and use
a particular callback, the following steps must be carried out:
main for this extension. When doing so, you
may use all of the methods defined in the callback class and its base
classes.clone is not
adequate and the callback is to be used for parallel optimization, this
method also needs to be implemented by the user. Recall that the default
clone method performs a shallow copy, so typically a user
implementation would perform a deep copy for objects that should be local to
threads or use the synchronize keyword where synchronization is
required.IloCplex with the method IloCplex.use.
The next time a solution method is executed on the IloCplex
object for which the callback has been set, the method main of
the callback will be called each time the corresponding point in the
optimization algorithm is reached.
The methods of this class are protected to make sure they are used only to
derive a user-written callback class or to implement the main
method in it.
| Modifier and Type | Method and Description |
|---|---|
protected void |
abort()
Aborts current optimization.
|
protected double |
getCplexTime()
This method returns a time stamp, useful in measuring elapsed time in
seconds.
|
protected double |
getDetTime()
This method returns a deterministic time stamp in ticks.
|
protected double |
getEndDetTime()
This method returns a deterministic time stamp specifying when the
deterministic time limit will occur.
|
protected double |
getEndTime()
This method returns a time stamp specifying when the time limit will occur.
|
protected IloEnv |
getEnvImpl() |
protected IloModel |
getModel()
Returns the model being solved when the invoking callback is called, that is
the active model.
|
protected int |
getNcols()
Returns the number of columns of the matrix representation of the active
model being solved when the invoking callback is called.
|
protected int |
getNQCs()
Returns the number of quadratic constraints in the active model being solved
when the invoking callback is called.
|
protected int |
getNrows()
Returns the number of rows of the matrix representation of the active model
being solved when the invoking callback is called.
|
protected double |
getStartDetTime()
This method returns a deterministic time stamp specifying when the solving
process was started.
|
protected double |
getStartTime()
This method returns a time stamp specifying when the solving process was
started.
|
protected abstract void |
main()
The method to be implemented by user callback classes.
|
protected abstract void main()
throws IloException
IloExceptionprotected void abort()
main method to instruct the invoking
IloCplex optimizer to abort the current optimization.protected IloModel getModel() throws IloException
IloExceptionprotected double getCplexTime()
This method returns a time stamp, useful in measuring elapsed time in seconds.
To measure time spent between a starting point and ending point of an operation, take the result of this method at the starting point; take the result of this method at the end point; subtract the starting time stamp from the ending time stamp; the subtraction yields elapsed time in seconds.
Whether the elapsed time measures wall clock time (also known as real time)
or CPU time depends on the setting of the clock type parameter
ClockType.
The absolute value of the time stamp is not meaningful.
protected double getDetTime()
This method returns a deterministic time stamp in ticks.
To measure elapsed deterministic time in ticks between a starting point and ending point of an operation, take the deterministic time stamp at the starting point; take the deterministic time stamp at the ending point; subtract the starting deterministic time stamp from the ending deterministic time stamp.
The absolute value of the deterministic time stamp is not meaningful.
protected double getStartTime()
This method returns a time stamp specifying when the solving process was
started. To compute elapsed time in seconds, subtract the result of
getCplexTime from the result of this method. This computation
yields either wall clock time (also known as real time) or CPU time,
depending on the clock type set by the parameter ClockType. The
absolute value of the time stamp is not meaningful.
protected double getStartDetTime()
This method returns a deterministic time stamp specifying when the solving
process was started. To compute elapsed time in ticks, subtract the result of
getDetTime from the result of this method.
The absolute value of the deterministic time stamp is not meaningful.
protected double getEndTime()
This method returns a time stamp specifying when the time limit will occur.
To compute remaining time in seconds, subtract the result of
getCplexTime from the result of this method. This computation
yields either wall clock time (also known as real time) or CPU time,
depending on the clock type set by the parameter ClockType. The
absolute value of the time stamp is not meaningful.
protected double getEndDetTime()
This method returns a deterministic time stamp specifying when the
deterministic time limit will occur. To compute remaining time in ticks,
subtract the result of getDetTime from the result of this
method.
The absolute value of the deterministic time stamp is not meaningful.
protected int getNrows()
protected int getNQCs()
protected int getNcols()
protected IloEnv getEnvImpl()