Skip to content

Commit

Permalink
Fix example of Gurobi-specific attributes from JuMP in README.md (#539)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Dec 15, 2023
1 parent 68311c5 commit 84750c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,11 @@ model = direct_model(Gurobi.Optimizer())
@variable(model, x >= 0)
@constraint(model, c, 2x >= 1)
@objective(model, Min, x)
MOI.set(model, Gurobi.ConstraintAttribute("Lazy"), c, 2)
grb = backend(model)
MOI.set(grb, Gurobi.ConstraintAttribute("Lazy"), index(c), 2)
optimize!(model)
MOI.get(model, Gurobi.VariableAttribute("LB"), x) # Returns 0.0
MOI.get(model, Gurobi.ModelAttribute("NumConstrs")) # Returns 1
MOI.get(grb, Gurobi.VariableAttribute("LB"), index(x)) # Returns 0.0
MOI.get(grb, Gurobi.ModelAttribute("NumConstrs")) # Returns 1
```

A complete list of supported Gurobi attributes can be found in
Expand Down

0 comments on commit 84750c2

Please sign in to comment.