Repository navigation
fix: round trip of a Solution with unset optional solver fields - #469
Merged
Merged
Conversation
An unset iterations, constraints_violation, message or status (NotProvided) is written as null/nothing and read back as NotProvided; the legacy string "NotProvided" is still read, and a wrong type raises a ParsingError. Closes #464. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #464.
Stacked on #468 (JSON.jl), itself stacked on #463: the base of this PR is
feat/json-jl-v1. Once #468 is merged, the base moves tomain.Problem
A
Solutionwhoseiterations,constraints_violation,messageorstatusareNotProvided(e.g. the ones built by an indirect method) could be exported but not imported, in JSON and JLD2:Float64("NotProvided")/Float64(NotProvided)raised a rawMethodError, and an unsetstatus/messagesilently came back as:NotProvided/"NotProvided".Changes
_serialize_solutionwritesnothing(nullin JSON) for an unset field, in both formats._optional(data, key, T): a missing key,nothing,NotProvidedor the legacy string"NotProvided"givesCore.NotProvided; a value of the wrong type raises aParsingError.get(blob, key, nothing).SERIALIZATION_FORMAT_VERSIONunchanged (2): files written before are still read.CHANGELOG.mdentry and docstrings updated.Tests
New
test/suite/serialization/test_optional_fields.jl(JSON and JLD2): four fields unset, four fields set, legacy file with"NotProvided", wrong type raisesParsingError, JSON file holdsnull. Serialization suite: 2257 passed. In the full suite, only the 3 plot test files fail (CTBase.Plotting.switching_vlines, unreleased CTBase #613), unrelated to this PR.Known limitation
A
statusormessagethat is genuinely the string"NotProvided"is read as unset (price of reading legacy files).🤖 Generated with Devin