Terminating without callbacks

Describes ways to terminate optimization without a callback.

If you simply want to terminate optimization under circumstances defined by your application, then you do not necessarily need to write a callback to do so. Instead, you can invoke termination by these means:

  • In the C++ API, pass an instance of the class IloCplex::Aborter to an instance of IloCplex . Then call the method IloCplex::Aborter::abort to terminate optimization.

  • In the Java API, pass an instance of the class IloCplex.Aborter to an instance of IloCplex . Then call the method IloCplex.Aborter.abort to terminate optimization.

  • In the .NET API, pass an instance of the class Cplex.Aborter to an instance of Cplex . Then call the method Cplex.Aborter.Abort to terminate optimization.

  • In the Callable Library (C API), call the routine CPXsetterminate to set a pointer to the termination signal. Initially, the value of the termination signal should be zero. When your application sets the termination signal to a nonzero value, then CPLEX will terminate optimization.

  • In the Python API, use the Aborter class to terminate optimization. See mipex4.py for an example.