MathOptInterface.jl

MathOptInterface is Julia abstration layer to interface with variety of mathematical optimization solvers.

Installation: OptimizationMOI.jl

To use this package, install the OptimizationMOI package:

import Pkg; Pkg.add("OptimizationMOI")

Details

As of now, the Optimization interface to MathOptInterface implements only the maxtime common keyword argument.

An optimizer which supports the MathOptInterface API can be called be called directly if no optimizer options have to be defined.

For example using the Ipopt.jl optimizer:

sol = solve(prob, Ipopt.Optimizer())

The optimizer options are handled in one of two ways. They can either be set via Optimization.MOI.OptimizerWithAttributes() or as keyword argument to solve.

For example using the Ipopt.jl optimizer:

opt = Optimization.MOI.OptimizerWithAttributes(Ipopt.Optimizer, "option_name" => option_value, ...)
sol = solve(prob, opt)

sol = solve(prob,  Ipopt.Optimizer(); option_name = option_value, ...)

Optimizers

Ipopt.jl (MathOptInterface)

KNITRO.jl (MathOptInterface)

Juniper.jl (MathOptInterface)

using Optimization, ForwardDiff
rosenbrock(x, p) =  (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
x0 = zeros(2)
_p  = [1.0, 100.0]

f = OptimizationFunction(rosenbrock, Optimization.AutoForwardDiff())
prob = Optimization.OptimizationProblem(f, x0, _p)

using Juniper, Ipopt
opt = Optimization.MOI.OptimizerWithAttributes(
    Juniper.Optimizer,
    "nl_solver"=>Optimization.MOI.OptimizerWithAttributes(Ipopt.Optimizer, "print_level"=>0),
)
sol = solve(prob, opt)