diff --git a/src/aff_expr.jl b/src/aff_expr.jl index 4c76f6ddc2e..97163bb769c 100644 --- a/src/aff_expr.jl +++ b/src/aff_expr.jl @@ -270,10 +270,6 @@ end GenericAffExpr{C,V}() where {C,V} = zero(GenericAffExpr{C,V}) -function _affine_coefficient(f::GenericAffExpr{C,V}, variable::V) where {C,V} - return get(f.terms, variable, zero(C)) -end - """ map_coefficients_inplace!(f::Function, a::GenericAffExpr) diff --git a/src/constraints.jl b/src/constraints.jl index ad61e0b9a89..c3489f5dce2 100644 --- a/src/constraints.jl +++ b/src/constraints.jl @@ -852,15 +852,10 @@ julia> normalized_coefficient(con, x) ``` """ function normalized_coefficient( - con_ref::ConstraintRef{<:AbstractModel,MOI.ConstraintIndex{F,S}}, + con_ref::ConstraintRef{<:AbstractModel,<:MOI.ConstraintIndex{F}}, variable, -) where { - S, - T, - F<:Union{MOI.ScalarAffineFunction{T},MOI.ScalarQuadraticFunction{T}}, -} - con = constraint_object(con_ref) - return _affine_coefficient(con.func, variable) +) where {F<:Union{MOI.ScalarAffineFunction,MOI.ScalarQuadraticFunction}} + return coefficient(constraint_object(con_ref).func, variable) end """ diff --git a/src/quad_expr.jl b/src/quad_expr.jl index 9d6fbf0ac49..3f638b1a8a9 100644 --- a/src/quad_expr.jl +++ b/src/quad_expr.jl @@ -252,10 +252,6 @@ function _map_quad( return GenericQuadExpr(aff, terms) end -function _affine_coefficient(f::GenericQuadExpr{C,V}, variable::V) where {C,V} - return _affine_coefficient(f.aff, variable) -end - """ constant(aff::GenericQuadExpr{C, V})::C