Skip to content

Commit b5997d4

Browse files
authored
[docs] remove has_values and has_duals from documentation (#3961)
1 parent c39bbd3 commit b5997d4

File tree

4 files changed

+19
-31
lines changed

4 files changed

+19
-31
lines changed

docs/src/manual/constraints.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,8 @@ equality constraint, it depends on which direction is binding.
648648
and [`reduced_cost`](@ref) instead.
649649

650650
The dual value associated with a constraint in the most recent solution can be
651-
accessed using the [`dual`](@ref) function. Use [`has_duals`](@ref) to check if
652-
the model has a dual solution available to query. For example:
651+
accessed using the [`dual`](@ref) function. For example:
652+
653653
```jldoctest con_duality
654654
julia> model = Model(HiGHS.Optimizer);
655655
@@ -664,13 +664,13 @@ con : x ≤ 1
664664
julia> @objective(model, Min, -2x)
665665
-2 x
666666
667-
julia> has_duals(model)
668-
false
667+
julia> dual_status(model)
668+
NO_SOLUTION::ResultStatusCode = 0
669669
670670
julia> optimize!(model)
671671
672-
julia> has_duals(model)
673-
true
672+
julia> dual_status(model)
673+
FEASIBLE_POINT::ResultStatusCode = 1
674674
675675
julia> dual(con)
676676
-2.0
@@ -680,6 +680,9 @@ julia> @objective(model, Max, 2x)
680680
681681
julia> optimize!(model)
682682
683+
julia> dual_status(model)
684+
FEASIBLE_POINT::ResultStatusCode = 1
685+
683686
julia> dual(con)
684687
-2.0
685688
```

docs/src/manual/solutions.md

-14
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,6 @@ The first means that the solver doesn't have a solution to return, and the
167167
second means that the primal solution is a certificate of dual infeasibility (a
168168
primal unbounded ray).
169169

170-
You can also use [`has_values`](@ref), which returns `true` if there is a
171-
solution that can be queried, and `false` otherwise.
172-
```jldoctest solutions
173-
julia> has_values(model)
174-
true
175-
```
176-
177170
### Objective values
178171

179172
The objective value of a solved problem can be obtained via
@@ -282,13 +275,6 @@ The first means that the solver doesn't have a solution to return, and the
282275
second means that the dual solution is a certificate of primal infeasibility (a
283276
dual unbounded ray).
284277

285-
You can also use [`has_duals`](@ref), which returns `true` if there is a
286-
solution that can be queried, and `false` otherwise.
287-
```jldoctest solutions
288-
julia> has_duals(model)
289-
true
290-
```
291-
292278
### Dual solution values
293279

294280
If the solver has a dual solution to return, use [`dual`](@ref) to access it:

src/constraints.jl

+7-8
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ That is, if `con_ref` is the reference of a constraint `func`-in-`set`, it
12811281
returns the value of `func` evaluated at the value of the variables (given by
12821282
[`value(::GenericVariableRef)`](@ref)).
12831283
1284-
Use [`has_values`](@ref) to check if a result exists before asking for values.
1284+
Use [`primal_status`](@ref) to check if a result exists before asking for values.
12851285
12861286
See also: [`result_count`](@ref).
12871287
@@ -1365,7 +1365,7 @@ end
13651365
Return the dual value of constraint `con_ref` associated with result index
13661366
`result` of the most-recent solution returned by the solver.
13671367
1368-
Use [`has_duals`](@ref) to check if a result exists before asking for values.
1368+
Use [`dual_status`](@ref) to check if a result exists before asking for values.
13691369
13701370
See also: [`result_count`](@ref), [`shadow_price`](@ref).
13711371
@@ -1387,8 +1387,8 @@ julia> @objective(model, Max, 2 * x + 1);
13871387
13881388
julia> optimize!(model)
13891389
1390-
julia> has_duals(model)
1391-
true
1390+
julia> dual_status(model)
1391+
FEASIBLE_POINT::ResultStatusCode = 1
13921392
13931393
julia> dual(c)
13941394
-2.0
@@ -1419,8 +1419,7 @@ Return the change in the objective from an infinitesimal relaxation of the
14191419
constraint.
14201420
14211421
The shadow price is computed from [`dual`](@ref) and can be queried only when
1422-
`has_duals` is `true` and the objective sense is `MIN_SENSE` or `MAX_SENSE`
1423-
(not `FEASIBILITY_SENSE`).
1422+
the objective sense is `MIN_SENSE` or `MAX_SENSE` (not `FEASIBILITY_SENSE`).
14241423
14251424
See also [`reduced_cost`](@ref JuMP.reduced_cost).
14261425
@@ -1463,8 +1462,8 @@ julia> @objective(model, Max, 2 * x + 1);
14631462
14641463
julia> optimize!(model)
14651464
1466-
julia> has_duals(model)
1467-
true
1465+
julia> dual_status(model)
1466+
FEASIBLE_POINT::ResultStatusCode = 1
14681467
14691468
julia> shadow_price(c)
14701469
2.0

src/variables.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -2078,7 +2078,7 @@ end
20782078
Return the value of variable `v` associated with result index `result` of the
20792079
most-recent returned by the solver.
20802080
2081-
Use [`has_values`](@ref) to check if a result exists before asking for values.
2081+
Use [`primal_status`](@ref) to check if a result exists before asking for values.
20822082
20832083
See also: [`result_count`](@ref).
20842084
"""
@@ -2620,8 +2620,8 @@ julia> @objective(model, Max, 2 * x + 1);
26202620
26212621
julia> optimize!(model)
26222622
2623-
julia> has_duals(model)
2624-
true
2623+
julia> dual_status(model)
2624+
FEASIBLE_POINT::ResultStatusCode = 1
26252625
26262626
julia> reduced_cost(x)
26272627
2.0

0 commit comments

Comments
 (0)