Skip to content

Commit

Permalink
Add MOI wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
blegat committed Jun 20, 2021
1 parent e439de4 commit 9ecf63f
Show file tree
Hide file tree
Showing 6 changed files with 539 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
NLSolversBase = "d41bc354-129a-5804-8e4c-c37616107c6c"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Expand All @@ -19,6 +20,7 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Compat = "3.2.0, 3.3.0, 3.4.0, 3.5.0, 3.6.0"
FillArrays = "0.6.2, 0.7, 0.8, 0.9, 0.10, 0.11"
LineSearches = "7.0.1"
MathOptInterface = "0.9.22"
NLSolversBase = "7.8.0"
NaNMath = "0.3.2"
Parameters = "0.10, 0.11, 0.12"
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ If you use `Optim.jl` in your work, please cite the following.
}
```

# Use with JuMP

We can use Optim.jl with [JuMP.jl](https://github.com/jump-dev/JuMP.jl).

This can be done using the `Optim.Optimizer` object. Here is how to create a JuMP
model that uses Optim as the solver to minimize the rosenbrock function.

```julia
using JuMP, Optim

model = Model(Optim.Optimizer)
set_optimizer_attribute(model, "method", BFGS())

@variable(model, x[1:2])
@NLobjective(model, (1.0 - x[1])^2 + 100.0 * (x[2] - x[1]^2)^2)
optimize!(model)
```

[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg
[docs-latest-url]: https://julianlsolvers.github.io/Optim.jl/latest

Expand Down
Loading

0 comments on commit 9ecf63f

Please sign in to comment.