It seems that a very common requirement is to get duals from a MIP problem. The traditional way of doing this is to relax the integer variables in the problem and fix them to their MIP solution and obtain the duals from the resulting relaxed LP.
However, doing this manually in JuMP is a little awkward, especially when solving a model in a loop. We have tried copying the model, creating a relaxed LP by removing all the integer costraints and fixing the integer variables and then solving the model in another thread - but this involves quite a bit of overhead.
Many solvers provide their own methods to do this. CPLEX has CPXXchgprobtype/CPXchgprobtype while Gurobi has GRBModel::fixedModel(). Would it not make sense to provide access in a generic way to these methods in JuMP?
Thanks @odow Does this take advantage of solver-specific routines to do it? E.g. CPLEX’s CPXXchgprobtype/CPXchgprobtype and Gurobi’s GRBModel::fixedModel() or does it just to the job of manually fixing the problem in JuMP more conveniently / efficiently?
Thanks @odow. It would be great if we could support the solver specific routines to do this at JuMP level - I believe there would be significant performance benefits as for large models there are significant overheads in manipulating the problem and restoring it afterwards.
This isn’t something we have the infrastructure to support in JuMP, and even if we could, it would require modifying the variables and constraints in JuMP to stay in sync with the internal model.
All that being said, if the solver-independent way is too slow for you, you can call the solver-specific C API and deal with the complications keeping the two models in sync in your own code.