Skip to content

Commit

Permalink
Merge pull request #351 from odow/patch-1
Browse files Browse the repository at this point in the history
Update OptimizationMOI README
  • Loading branch information
ChrisRackauckas authored Aug 22, 2022
2 parents bd1c191 + cd73c69 commit 769e2d9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions docs/src/optimization_packages/mathoptinterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ optimizer:


```julia
using OptimizationMOI, Ipopt
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`.
`OptimizationMOI.MOI.OptimizerWithAttributes()` or as keyword argument to `solve`.

For example using the `Ipopt.jl` optimizer:

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

sol = solve(prob, Ipopt.Optimizer(); option_name = option_value, ...)
Expand Down Expand Up @@ -68,10 +70,10 @@ _p = [1.0, 100.0]
f = OptimizationFunction(rosenbrock, Optimization.AutoForwardDiff())
prob = Optimization.OptimizationProblem(f, x0, _p)

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

0 comments on commit 769e2d9

Please sign in to comment.