Connection between solver and Julia's JuMP Package

I’m looking for ways or tips to connect a simple 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.

Which solver?

MathOptInterface (which we call MOI) can be quite daunting to begin with. It has a lot of details, and the documentation is sub-par :slightly_frowning_face:. In addition, the approach to take depends quite heavily on the type of solver you want to connect.

Feel free to come say hi here as well: JuliaOpt/JuMP-dev - Gitter

1 Like

Yeah, and scared is a good adjective for me yesterday when i tried to understand MOI, :sweat_smile:

I wanted to connect JuMP with a simple GA algorithm. I know that already have a GA package, but it’s for trainning, after I’ll need to put anothers solvers that I don’t have access yet to connect with JuMP.

GA=genetic?

JuMP an MOI are really for constrained optimization. Does your solver understand constraints? If so, what types? What type of objective function does it support? You might be better off looking at https://github.com/JuliaNLSolvers/Optim.jl

1 Like

Yes. I solved just few examples with it (a Knapsack Problem and a minimum point), the constraints i’m putting like a rule in the creation, mutation and/or update of the population, and penalizing in the objective function.

“function genetic_algorithm(f, population, k_max, S::SelectionMethod, C::CrossoverMethod, M::MutationMethod, U::UpdatePopulationMethod, f_reini, p_reini, reini = 4)”, f is the function that measures the adaptability of a individual, population is the initial population, k_max is the number of iterations, f_reini is a function that creates the population, with it’s parameters in p_reini, and reini being the number of times that a population can be updated with no improvement before the reinicializing of the population.

I’ll look for answers in this link, thanks. Just one more doubt, even that my solver doesn’t support restrictions directly, can i try to connect with the JuMP? Just for training.

my solver doesn’t support restrictions directly, can i try to connect with the JuMP?

If you don’t support structured mathematical programming (variables, constraints, etc), then you won’t benefit from connecting to JuMP. It’s a non-trivial amount of work.

What is the limitation of your current interface?

2 Likes

It’s of course possible to connect JuMP to a solver that doesn’t support constraints, but it’s not the intent of the interface, and it will require more work than you expect. Usually pure function interfaces like Optim’s are better suited for this.

Thanks for your help. Since you both said that would be to much work, I’ll wait for instructions and details about the other solver that will be used for the problems that we have. Thank you both.