ILOG CPLEX C++ API 9.0 Reference Manual
ILOG CPLEX C++ API 9.0 Reference Manual
ILOG CPLEX C++ API 9.0 Reference Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
IloCplex::CallbackI<br />
◆<br />
◆<br />
When cplex.use(cb) is called for a callback object cb that is already used by<br />
another instance of IloCplex, a copy of the implementation object of cb is<br />
created by calling duplicateCallback and used in its place. The method use<br />
will return a handle to that copy.<br />
When a parallel optimizer is used, IloCplex creates copies of every callback that<br />
it uses by calling duplicateCallback. One copy of a callback is created for<br />
each additional thread being used in the parallel optimizer. During the optimization,<br />
each thread will invoke the copy corresponding to the thread number. The methods<br />
provided by the callback <strong>API</strong>s are guaranteed to be threadsafe. However, when<br />
accessing parameters passed to callbacks or members stored in a callback, it is up to<br />
the user to make sure of thread safety by synchronizing access or creating distinct<br />
copies of the data in the implementation of duplicateCallback.<br />
protected IloEnv getEnv()<br />
This method returns the environment belonging to the IloCplex object that invoked<br />
the method main.<br />
protected IloModel getModel()<br />
This method returns the model currently extracted for the instance of IloCplex where<br />
the invoking callback executed.<br />
protected IloInt getNcols()<br />
This method returns the number of columns in the model currently being optimizated.<br />
protected IloInt getNQCs()<br />
This method returns the number of quadratic constraints in the model currently being<br />
optimized.<br />
protected IloInt getNrows()<br />
This method returns the number of rows in the model currently being optimized.<br />
protected virtual void main()<br />
This virtual method is to be implemented by the user in a derived callback class to define<br />
the functionality of the callback. When an instance of IloCplex uses a callback (an<br />
instance of IloCplex::CallbackI or one of its derived subclasses), IloCplex<br />
calls this virtual method main at the point during the optimization at which the callback<br />
is executed.<br />
<strong>ILOG</strong> <strong>CPLEX</strong> <strong>C++</strong> <strong>API</strong> <strong>9.0</strong> REFERENCE M ANUAL 101