I'm looking for ways or tips to connect a solver with the JuMP Package. I started reading the manual of Math Opt Interface (I don't know the right terms, but I'll call it the Backend of the JuMP), also I'm trying to understand the codes of a solver fully written in Julia that has this connection with JuMP, but still I don't know if it's a good way to learn how to do it and I'm having trouble to understand some parts of the codes, I think I'll take much time if I continue like this.
The best place to ask (and get answer from the JuMP developers) is this Discourse forum. You should provide details such as the class of models that are supported and, ideally, a link to the code itself (or at least its Julia wrapper if applicable).
There are also a number of guidelines in the MathOptInterface documentation.
That being said, in a nutshell, the route looks like:
- If your solver is not written in Julia, you need to hook it to Julia first. The how depends on which language you used.
- Once you have a Julia interface, you need to implement an interface to MathOptInterface.
To do so, you need to identify which functionalities your solver supports (linear? conic? mixed-integer? something else?) and how they are represented in MathOptInterface.
Looking at other solvers' wrappers (look for a file called
MOI_wrapperin, e.g., CPLEX.jl, Gurobi.jl or GLPK.jl) is good place to start. The MathOptInterface package also provides extensive unit tests to ensure the interface works correctly.
Once your solver is interfaced to MathOptInterface, it can be used in JuMP. There is no additional thing to do.
Most Solvers are connected to
MathOptInterface.jl using their respective C APIs. Depending on the solver you trying to connect there is a good chance there is a C API for it. This article has some great information about connecting a C API to MathOptInterface. I bet if you sent an email to the author, he would respond too.
JuMP also supports ASL interfaces, you can find detailed instructions on how to connect a solver with an ASL interface here.