12
$\begingroup$

I am 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 JuMP. Also, I am trying to understand the codes of a solver fully written in Julia that has this connection with JuMP, but I still don't know if it's a good way to learn how to do it and I'm having trouble understanding some parts of the code. I think it will take much time if I continue like this.

$\endgroup$
6
  • 1
    $\begingroup$ 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. $\endgroup$
    – EhsanK
    Jan 5, 2020 at 14:26
  • $\begingroup$ 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). $\endgroup$ Jan 7, 2020 at 15:17
  • $\begingroup$ 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. $\endgroup$
    – EhsanK
    Jan 7, 2020 at 15:46
  • $\begingroup$ Thanks. Just one more question if I'm not bothering you too much, now do you think that the question is clear enough? $\endgroup$ Jan 7, 2020 at 19:01
  • 2
    $\begingroup$ This question seems as though it might be better asked on a Julia mailing list. $\endgroup$
    – Richard
    Jan 7, 2020 at 21:57

3 Answers 3

5
$\begingroup$

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.

$\endgroup$
2
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

JuMP also supports ASL interfaces, you can find detailed instructions on how to connect a solver with an ASL interface here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.