Automatic reformulation using constraint bridges
A same mathematical optimization problem often possess different equivalent formulations but a given solver may only support one of them. Writing this solver specific formulation is inconvenient when the solver is not familiar to the user and it is not an option when writing solver independent code. This motivates the need of a mechanism that, given a model and a solver, automatically rewrites the model into an equivalent one supported by the solver. To make this rewritting transparent, the solver result also need to be automatically transformed into the original problem formulation. We introduce the MathOptInterfaceBridges package implementing constraint bridges for MathOptInterface. When applied to a solver, the bridge automatically rewrites each constraint of the corresponding type into an equivalent form while keeping the necessary information to translate the result back to the user. In MathOptInterface, each solver declares the constraint types supported. This information is used by the AutomaticBridger to algorithmically determine a reformulation of a given model into one supported by a given solver. As the reformulation is done constraint-wise, it never uses the full model information hence does not need to maintain a copy of the model. When different reformulations are available, heuristics are used to determine the formulation that will incur the lower computational cost to the solver.
