Skip to content

Reset MockOptimizer result count in empty! - #3127

Merged
odow merged 2 commits into
masterfrom
bl/mock-empty-result-count
Oct 31, 2026
Merged

odow merged 2 commits into
masterfrom
bl/mock-empty-result-count

Conversation

@blegat

@blegat blegat commented Oct 30, 2026

Copy link
Copy Markdown
Member

We use a MockOptimizer wrapping a FileFormats.MOF in NexOR.jl, In NexOR-Optimization/NexOR.jl#12, I had the issue that MockOptimizer was reporting a ResultCount() of 1 even just after being emptied.
This PR is a simple fix for that.

When MockOptimizer reports results, empty! clears its stored solutions but
leaves ResultCount at the previous value. Reset the count to zero so result
queries correctly raise ResultIndexBoundsError after emptying the model.

Add a regression covering previous result counts of zero, one, and two, as
well as the objective-value result-index bounds check.

Validation: all tests in test/Utilities/test_mockoptimizer.jl pass;
JuliaFormatter 2.14.0.
Attaching the cache empties the mock and resets its result count. Set ResultCount to one before configuring the feasible status.
@odow
odow merged commit 9a4d1b9 into master Oct 31, 2026
55 of 56 checks passed
@odow
odow deleted the bl/mock-empty-result-count branch October 31, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants