Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Utilities/cachingoptimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ function MOI.get(
"optimizer is attached.",
)
end
MOI.check_result_index_bounds(model, attr)
try
return MOI.get(
model.optimizer,
Expand All @@ -923,6 +924,7 @@ function MOI.get(
"optimizer is attached.",
)
end
MOI.check_result_index_bounds(model, attr)
try
return MOI.get(
model.optimizer,
Expand Down
10 changes: 10 additions & 0 deletions test/Utilities/cachingoptimizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ MOI.get(::_ConstraintPrimal1310, ::MOI.ListOfModelAttributesSet) = []

MOI.get(::_ConstraintPrimal1310, ::MOI.PrimalStatus) = MOI.FEASIBLE_POINT

MOI.get(::_ConstraintPrimal1310, ::MOI.ResultCount) = 1

function MOI.optimize!(::_ConstraintPrimal1310, model::MOI.ModelLike)
index_map = MOI.IndexMap()
for x in MOI.get(model, MOI.ListOfVariableIndices())
Expand Down Expand Up @@ -845,6 +847,14 @@ function test_ConstraintPrimal_fallback()
MOI.optimize!(model)
@test MOI.get(model, MOI.ConstraintPrimal(), c) == 1.2
@test MOI.get(model, MOI.ConstraintPrimal(), [c]) == [1.2]
@test_throws(
MOI.ResultIndexBoundsError(MOI.ConstraintPrimal(2), 1),
MOI.get(model, MOI.ConstraintPrimal(2), c),
)
@test_throws(
MOI.ResultIndexBoundsError(MOI.ConstraintPrimal(2), 1),
MOI.get(model, MOI.ConstraintPrimal(2), [c]),
)
return
end

Expand Down