Luigi Poderico 

Software and Operational Research 

Optimization Template interface

This page describe a proposal for a c++ template based abstraction interface for mathematical optimization software.
The major problem for an optimization software writer is to switch from a solver to another. This because every solver has got its own interface. The most famous project facing this problem is OSI, that uses abstract classes and virtual functions to build and to implement the general interface and the several implementations.
My proposal is to use template and the basic concepts of template meta programming. This allows solver abstraction with no runtime costs. I've reused many concepts and ideas from STL and boost.
Using the most common subdivision, oti library provides environment and problem classes. Each class is a template on an integer representing the solver to implement. Currently three solvers are provided as example: cplex, osl and mosek. Just the mosek implementation is used and tested in real applications.
From a practical point of view, the user:
selects which solver to use;
using the type generator asks to OTI to generate the right types for an environment and a problem;
uses them with the common interface.
A very short document describing the OTI library is available here.
The complete source code is available here.
Please send any comments at lupoderi@tiscali.it
.