Initializing help system before first use

Solver interaction: Setting up solution callbacks

The solvers of FICO® Xpress Optimization offer various entry points for interaction with the solver during optimizations runs. This interaction takes the form of user-defined functions with a fixed format (callback functions) that are invoked by the solver at specific points. Callback functions may be used for logging purposes, but some also allow you to modify the optimization algorithms, e.g., by adding your own cutting plane algorithms or even defining new branching objects and strategies for the MIP branch-and-bound search.

Among the most frequently used functions certainly is the integer solution callback of Xpress Optimizer that provides access to MIP solutions at the point where they are found during the branch-and-bound search.

»Scenario 1 (Mosel)

A unique feature of the Mosel language is the possibility to define subroutines in this high-level modeling language that will be called from the underlying (solver) libraries. It is thus possible to work with Optimizer callback functions directly in your Mosel models.

Open the file examples\getting_started\Mosel\foliocb.mos to see an example of how to define an integer solution callback in Mosel.

»Scenario 2 (BCL)

With BCL you can directly use the callback functionality of the corresponding Xpress Optimizer interface. Depending on your host language, open the file foliocb.[c|cxx|java] located in the corresponding subdirectory examples\bcl\[C|Cxx|Java]\UGExpl for an example of how to use the Optimizer integer solution callback with a BCL model formulation.

»Scenario 3 (Optimizer Python interface)

The Xpress Python interface provides a thin-layer API to all of the Optimizer's callback functions. The examples\python\ directory contains three examples: example_bbtree.py, example_tsp.py, and miqcqp_solver.py, which showcase the use of callback functions. The first uses branch callbacks to keep track of the branch-and-bound tree, and uses the collected information to draw the BB tree using the matplotlib module. The second example, example_tsp.py implements a simple solver for the Traveling Salesman Problem (TSP), and has callbacks for checking that the solution is a Hamiltonian tour and for adding subtour-elimination cuts. Finally, miqcqp_solver.py is a full-fledged solver for nonconvex mixed integer quadratically constrained problems, i.e. problems with possibly quadratic nonconvex function and nonconvex quadratic constraints, and with integrality constraints on part of the variables. This example is the most complex and shows how to use callbacks for adding cuts (for convexification of the nonconvex members of the problem), for branching on continuous variables, and for obtaining feasible solutions.

Further information

  • Documentation of Xpress Optimizer callbacks: ``Xpress Optimizer Reference Manual'', 5.3 `Using the Callbacks'
  • See the ``Xpress Mosel User Guide'', 11.1 `Cut generation', and the Xpress whitepapers ``Embedding Optimization Algorithms'' and ``Hybrid MIP/CP solving'' for examples of callback definition in Mosel
  • Documentation of Xpress Optimizer callbacks in Mosel: ``Mosel Language Reference Manual'', Chapter 13: `mmxprs'
  • Examples of using Xpress Optimizer callbacks with BCL: ``BCL Reference Manual'', Appendix B `Using BCL with the Optimizer library'
  • Python: see examples in the ``Python interface manual'', Chapter 6

© 2001-2019 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.