Skip to content

Commit e929d24

Browse files
committed
Update
1 parent 90c2708 commit e929d24

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/Utilities/results.jl

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ function get_fallback(
8686
return value::T
8787
end
8888

89-
_has_constant(::Type{<:MOI.AbstractScalarSet}) = true
90-
_has_constant(::Type{<:MOI.AbstractVectorSet}) = false
91-
_has_constant(::Type{<:MOI.HyperRectangle}) = true
92-
9389
function _dual_objective_value(
9490
model::MOI.ModelLike,
9591
::Type{F},
@@ -98,8 +94,10 @@ function _dual_objective_value(
9894
result_index::Integer,
9995
)::T where {T,F<:MOI.AbstractFunction,S<:MOI.AbstractSet}
10096
value = zero(T)
101-
if F == variable_function_type(S) && !_has_constant(S)
102-
return value # Shortcut
97+
if F == variable_function_type(S) && !_variable_set_in_dual_objective(S)
98+
# Early return. This is a constraint like x in R_+, so no contribution
99+
# appears in the dual objective.
100+
return value
103101
end
104102
for ci in MOI.get(model, MOI.ListOfConstraintIndices{F,S}())
105103
constant = MOI.constant(MOI.get(model, MOI.ConstraintFunction(), ci), T)
@@ -110,6 +108,18 @@ function _dual_objective_value(
110108
return value
111109
end
112110

111+
_variable_set_in_dual_objective(::Type{<:MOI.AbstractSet}) = false
112+
113+
_variable_set_in_dual_objective(::Type{<:MOI.EqualTo}) = true
114+
115+
_variable_set_in_dual_objective(::Type{<:MOI.GreaterThan}) = true
116+
117+
_variable_set_in_dual_objective(::Type{<:MOI.LessThan}) = true
118+
119+
_variable_set_in_dual_objective(::Type{<:MOI.Interval}) = true
120+
121+
_variable_set_in_dual_objective(::Type{<:MOI.HyperRectangle}) = true
122+
113123
_dual_objective_dot(x, y, set) = set_dot(x, y, set)
114124

115125
_dual_objective_dot(x, y, set::MOI.EqualTo) = (x - set.value) * y

0 commit comments

Comments
 (0)