The C++ API

The Open Solver Interface (OSI) is a C++ class that provides a standard API for accessing a variety of solvers for mathematical programs. It is provided as part of the COIN-OR repository [24], along with a collection of solver-specific derived classes that translate OSI call into calls to the underlying libraries of the solvers. A code implemented using calls to the methods in the OSI base class can easily be linked with any solver for which there is an OSI interface. This allows development of solver-independent codes and eliminates many portability issues. The current incarnation of OSI supports only solvers for linear and mixed-integer linear programs, although a new version supporting a wider variety of solvers is currently under development.

We have implemented an OSI interface for SYMPHONY 5.7.1 that allows any solver built with SYMPHONY to be accessed through the OSI, including customized solvers and those configured to run on parallel architectures. To ease code maintenance, for each method in the OSI base class, there is a corresponding method in the callable library. The OSI methods are implemented simply as wrapped calls to the SYMPHONY callable library. When an instance of the OSI interface class is constructed, a call is made to sym_open_environment() and a pointer to the environment is stored in the class. Most subsequent calls within the class can then be made without any arguments. When the OSI object is destroyed, sym_close_environment is called and the environment is destroyed.

To fully support SYMPHONY's capabilities, we have extended the OSI interface to include some methods not in the base class. For example, we added calls equivalent to our sym_parse_command_line() and sym_find_initial_bounds(). Figure 3.5 shows the program of Figure 3.1 implemented using the OSI interface.

Figure 3.5: Implementation of a generic MILP solver with the SYMPHONY OSI interface.
\begin{figure}{\color{brown}
\begin{Verbatim}[frame=lines]
int main(int argc, ch...
... argv);
si.loadProblem();
si.branchAndBound();
}\end{Verbatim}
}\end{figure}
Note that the code would be exactly the same for accessing any customized SYMPHONY solver, sequential or parallel.

Although we are using the OSI to access a MILP solver, the current version of the OSI is geared primarily toward support of solvers for linear programming (LP) problems. This is because LP solvers employing some version of the simplex algorithm support much richer functionality and a wider range of interface functions, due to their support of warm starting from previously saved checkpoints. This functionality is difficult to provide for MILP solvers. In SYMPHONY 5.7.1, we have implemented for MILPs some of the same functionality that has long been available for LP solvers. As such, our OSI interface supports warm starting and sensitivity analysis. The implementations of this functionality is straightforward at the moment, but will be improved in future versions.