Skip to content

Commit 69a6e29

Browse files
authored
Merge pull request #792 from JuliaOpt/bl/doc_fallback
Add get_fallback in doc
2 parents 660f13d + b4f204d commit 69a6e29

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/src/apireference.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ set
4444
supports
4545
```
4646

47+
### Fallbacks
48+
49+
The value of some attributes can be inferred from the value of other
50+
attributes. For instance, the value of [`ObjectiveValue`](@ref) can be computed
51+
using [`ObjectiveFunction`](@ref) and [`VariablePrimal`](@ref). When a solver
52+
gives access to the objective value, it is better to return this value but
53+
otherwise, [`Utilities.get_fallback`](@ref) can be used.
54+
```julia
55+
function MOI.get(optimizer::Optimizer, attr::MOI.ObjectiveValue)
56+
return MOI.Utilities.get_fallback(optimizer, attr)
57+
end
58+
```
59+
60+
```@docs
61+
Utilities.get_fallback
62+
```
63+
4764
### Submit
4865

4966
Objects may be submitted to an optimizer using [`submit`](@ref).

0 commit comments

Comments
 (0)