Skip to content

Commit 3f5fde2

Browse files
Apply suggestions from code review
Co-authored-by: Oscar Dowson <odow@users.noreply.github.com>
1 parent 79103cc commit 3f5fde2

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/Infeasibility/analyze.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ Return a dictionary mapping constraint indices in the destination model back to
7575
constraint indices in the source model.
7676
"""
7777
function _reverse_index_map(index_map::MOI.IndexMap)
78-
ret = Dict{MOI.ConstraintIndex,MOI.ConstraintIndex}()
78+
return Dict{MOI.ConstraintIndex,MOI.ConstraintIndex}(
79+
v => k for (k, v) in index_map.con_map
80+
)
7981
for (k, v) in index_map.con_map
8082
ret[v] = k
8183
end
@@ -88,10 +90,11 @@ end
8890
Return `true` if the constraint index is a variable-level constraint
8991
(i.e., `F == MOI.VariableIndex`).
9092
"""
91-
function _is_variable_constraint(::MOI.ConstraintIndex{MOI.VariableIndex})
93+
_is_variable_constraint(::MOI.ConstraintIndex{MOI.VariableIndex}) = true
9294
return true
9395
end
94-
function _is_variable_constraint(::MOI.ConstraintIndex)
96+
97+
_is_variable_constraint(::MOI.ConstraintIndex) = false
9598
return false
9699
end
97100

@@ -103,8 +106,8 @@ constraint.
103106
"""
104107
function _is_integrality_constraint(
105108
::MOI.ConstraintIndex{MOI.VariableIndex,S},
106-
) where {S}
107-
return S <: Union{MOI.Integer,MOI.ZeroOne}
109+
) where {S<: Union{MOI.Integer,MOI.ZeroOne}}
110+
return true
108111
end
109112
function _is_integrality_constraint(::MOI.ConstraintIndex)
110113
return false

0 commit comments

Comments
 (0)