Skip to content

Commit

Permalink
[docs] update docstring of is_solved_and_feasible (#3932)
Browse files Browse the repository at this point in the history
  • Loading branch information
odow authored Jan 30, 2025
1 parent cb075a1 commit b734e12
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions src/optimizer_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ end
)
Return `true` if:
* the [`termination_status`](@ref) is one of:
* [`OPTIMAL`](@ref) (the solver found a global optimum)
* [`LOCALLY_SOLVED`](@ref) (the solver found a local optimum, which may also
Expand All @@ -823,24 +822,36 @@ Return `true` if:
This function is conservative, in that it returns `false` for situations like
the solver terminating with a feasible solution due to a time limit.
If this function returns `false`, use [`termination_status`](@ref),
[`result_count`](@ref), [`primal_status`](@ref) and [`dual_status`](@ref) to
understand what solutions are available (if any).
See also: [`assert_is_solved_and_feasible`](@ref).
## Keyword arguments
### `allow_local`
If `allow_local = false`, then this function returns `true` only if the
[`termination_status`](@ref) is [`OPTIMAL`](@ref).
### `allow_almost`
If `allow_almost = true`, then the [`termination_status`](@ref) may additionally
be [`ALMOST_OPTIMAL`](@ref) or [`ALMOST_LOCALLY_SOLVED`](@ref) (if `allow_local`),
and the [`primal_status`](@ref) and [`dual_status`](@ref) may additionally be
[`NEARLY_FEASIBLE_POINT`](@ref).
If `dual`, additionally use [`dual_status`](@ref) to check that a dual feasible
point is available.
### `dual`
If this function returns `false`, use [`termination_status`](@ref),
[`result_count`](@ref), [`primal_status`](@ref) and [`dual_status`](@ref) to
understand what solutions are available (if any).
If `dual`, additionally check that an optimal dual solution is available via
[`dual_status`](@ref). The `allow_` keywords control both the primal and dual
solutions.
### `result`
The index of the result to query. This value is passed to the `result` keyword
arguments of [`primal_status`](@ref) and [`dual_status`](@ref).
## Example
Expand All @@ -851,6 +862,14 @@ julia> model = Model(Ipopt.Optimizer);
julia> is_solved_and_feasible(model)
false
julia> is_solved_and_feasible(
model;
allow_almost = true,
dual = true,
result = 2,
)
false
```
"""
function is_solved_and_feasible(
Expand Down

0 comments on commit b734e12

Please sign in to comment.