# Connection between solver and Julia's JuMP Package

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.

• Welcome to OR.SE! What do you mean by creating a solver? Are you asking about best practices to design a solver? If so, check Implementing solvers with Object Oriented Programming and check other questions on the site. Your question as it stands is not very clear and needs more details. – EhsanK Jan 5 '20 at 14:26
• Thanks. In fact, I already have the solver, but I'm having trouble to connect it with the JuMP Package. I'm reading the manual of the MathOptInterface and seeing a solver with this connection, but I don't know if it's a good way to learn how to do it and I'm not understanding very well from the other solver's code (probably because I'm new to programming). – Josa Ferreira Jan 7 '20 at 15:17
• Then I would suggest that you modify your question (the title and its body) to reflect your comment. I think what you asked and what you just described in the comment are different. After the modification and a clearer explanation of your question, it can be in the queue for re-opening. – EhsanK Jan 7 '20 at 15:46
• Thanks. Just one more question if I'm not bothering you too much, now do you think that the question is clear enough? – Josa Ferreira Jan 7 '20 at 19:01
• This question seems as though it might be better asked on a Julia mailing list. – Richard Jan 7 '20 at 21:57

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:

1. If your solver is not written in Julia, you need to hook it to Julia first. The how depends on which language you used.
2. 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_wrapper in, 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 JuMP.jl through 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.