Skip to content

Commit ff29f2e

Browse files
authored
Disable ConstraintPrimal for ScalarAffine and ScalarQuadratic (#335)
1 parent 88ac497 commit ff29f2e

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

ext/KNITROMathOptInterfaceExt.jl

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,26 +1575,28 @@ function MOI.get(model::Optimizer, attr::MOI.VariablePrimal, x::MOI.VariableInde
15751575
return _get_solution(model, x.value)
15761576
end
15771577

1578-
function MOI.get(
1579-
model::Optimizer,
1580-
attr::MOI.ConstraintPrimal,
1581-
ci::MOI.ConstraintIndex{S,T},
1582-
) where {
1583-
S<:Union{MOI.ScalarAffineFunction{Float64},MOI.ScalarQuadraticFunction{Float64}},
1584-
T<:Union{
1585-
MOI.EqualTo{Float64},
1586-
MOI.GreaterThan{Float64},
1587-
MOI.LessThan{Float64},
1588-
MOI.Interval{Float64},
1589-
},
1590-
}
1591-
MOI.check_result_index_bounds(model, attr)
1592-
MOI.throw_if_not_valid(model, ci)
1593-
indexCon = model.constraint_mapping[ci]
1594-
p = Ref{Cdouble}(NaN)
1595-
KNITRO.@_checked KNITRO.KN_get_con_value(model.inner, indexCon, p)
1596-
return p[]
1597-
end
1578+
# See KNITRO.jl#333
1579+
#
1580+
# function MOI.get(
1581+
# model::Optimizer,
1582+
# attr::MOI.ConstraintPrimal,
1583+
# ci::MOI.ConstraintIndex{S,T},
1584+
# ) where {
1585+
# S<:Union{MOI.ScalarAffineFunction{Float64},MOI.ScalarQuadraticFunction{Float64}},
1586+
# T<:Union{
1587+
# MOI.EqualTo{Float64},
1588+
# MOI.GreaterThan{Float64},
1589+
# MOI.LessThan{Float64},
1590+
# MOI.Interval{Float64},
1591+
# },
1592+
# }
1593+
# MOI.check_result_index_bounds(model, attr)
1594+
# MOI.throw_if_not_valid(model, ci)
1595+
# indexCon = model.constraint_mapping[ci]
1596+
# p = Ref{Cdouble}(NaN)
1597+
# KNITRO.@_checked KNITRO.KN_get_con_value(model.inner, indexCon, p)
1598+
# return p[]
1599+
# end
15981600

15991601
# function MOI.get(
16001602
# model::Optimizer,

0 commit comments

Comments
 (0)