Description
I have no immediate plans to update CPLEX.jl for MOI, so I thought I would lay out the upgrade path for someone who needs CPLEX.jl for the new version of JuMP. It shouldn't be too much work.
The easiest way to wrap CPLEX.jl is to use LinQuadOptInterface.jl (LQOI).
LQOI provides an interface that is close to the functions required by CPLEX.jl:
https://github.com/JuliaOpt/LinQuadOptInterface.jl/blob/master/src/solver_interface.jl
For most functions, it is simply a case of matching up the LQOI function to an existing CPLEX function. For example, the LQOI function add_variables!
could be wrapped like:
function LQOI.add_variables!(model::Optimizer, number_to_add::Int)
add_vars!(model.inner, fill(0.0, number_to_add), fill(-Inf, number_to_add),
fill(Inf, number_to_add))
end
In order to guide the implementation, please take a look at the Gurobi, GLPK, and Xpress wrappers.
Gurobi
Here is src/MOIWrapper.jl
for Gurobi:
https://github.com/JuliaOpt/Gurobi.jl/blob/master/src/MOIWrapper.jl
and the test/MOIWrapper.jl
:
https://github.com/JuliaOpt/Gurobi.jl/blob/master/test/MOIWrapper.jl
GLPK
Here is src/MOIWrapper.jl
for GLPK:
https://github.com/JuliaOpt/GLPK.jl/blob/master/src/MOIWrapper.jl
and the test/MOIWrapper.jl
:
https://github.com/JuliaOpt/GLPK.jl/blob/master/test/MOIWrapper.jl
Clp
Xpress
Here is src/MOIWrapper.jl
for Xpress:
https://github.com/JuliaOpt/Xpress.jl/blob/master/src/MOIWrapper.jl
and the test/MOIWrapper.jl
:
https://github.com/JuliaOpt/Xpress.jl/blob/master/test/MOIWrapper.jl