Skip to content

Commit

Permalink
change docstring according to pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed May 26, 2021
1 parent 82058d8 commit 1b8a6b1
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/JuMP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,28 @@ function direct_model(backend::MOI.ModelLike)
end

"""
direct_model(optimizer::MOI.OptimizerWithAttributes)
direct_model(factory::MOI.OptimizerWithAttributes)
Return a new JuMP model that instantiates a [`OptimizerWithAttributes`](@ref) to store the
model and solve it.
Create a [`direct_model`](@ref) using `factory`, a `MOI.OptimizerWithAttributes`
object created by [`optimizer_with_attributes`](@ref).
## Example
```julia
model = direct_model(
optimizer_with_attributes(
Gurobi.Optimizer,
"Presolve" => 0,
"OutputFlag" => 1,
)
)
```
is equivalent to:
```julia
model = direct_model(Gurobi.Optimizer())
set_optimizer_attribute(model, "Presolve", 0)
set_optimizer_attribute(model, "OutputFlag", 1)
```
"""
function direct_model(factory::MOI.OptimizerWithAttributes)
optimizer = MOI.instantiate(factory)
Expand Down

0 comments on commit 1b8a6b1

Please sign in to comment.