From b4f204d57ddaccb66ca9707c0081be7d0cfcfbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 14 Jul 2019 15:45:49 +0200 Subject: [PATCH] Add get_fallback in doc --- docs/src/apireference.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/src/apireference.md b/docs/src/apireference.md index 2bdb4f5b46..1a1ee9773b 100644 --- a/docs/src/apireference.md +++ b/docs/src/apireference.md @@ -44,6 +44,23 @@ set supports ``` +### Fallbacks + +The value of some attributes can be inferred from the value of other +attributes. For instance, the value of [`ObjectiveValue`](@ref) can be computed +using [`ObjectiveFunction`](@ref) and [`VariablePrimal`](@ref). When a solver +gives access to the objective value, it is better to return this value but +otherwise, [`Utilities.get_fallback`](@ref) can be used. +```julia +function MOI.get(optimizer::Optimizer, attr::MOI.ObjectiveValue) + return MOI.Utilities.get_fallback(optimizer, attr) +end +``` + +```@docs +Utilities.get_fallback +``` + ### Submit Objects may be submitted to an optimizer using [`submit`](@ref).