Enable json serialization of ScalarizedOutcomeConstraint (#5025)#5025
Open
metactc wants to merge 1 commit intofacebook:mainfrom
Open
Enable json serialization of ScalarizedOutcomeConstraint (#5025)#5025metactc wants to merge 1 commit intofacebook:mainfrom
metactc wants to merge 1 commit intofacebook:mainfrom
Conversation
18fa6ec to
c2bea5c
Compare
metactc
added a commit
to metactc/Ax
that referenced
this pull request
Mar 19, 2026
Summary: Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage. = Background ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused. = Solution This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective. = Motivation This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail. **Note:** The SQA (database) store already handles this type; the JSON store was the only gap. Reviewed By: bletham Differential Revision: D96486632
metactc
added a commit
to metactc/Ax
that referenced
this pull request
Mar 19, 2026
Summary: Pull Request resolved: facebook#5025 Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage. = Background ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused. = Solution This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective. = Motivation This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail. **Note:** The SQA (database) store already handles this type; the JSON store was the only gap. Reviewed By: bletham Differential Revision: D96486632
c2bea5c to
c947059
Compare
metactc
added a commit
to metactc/Ax
that referenced
this pull request
Mar 19, 2026
Summary: Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage. = Background ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused. = Solution This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective. = Motivation This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail. **Note:** The SQA (database) store already handles this type; the JSON store was the only gap. Reviewed By: bletham Differential Revision: D96486632
c947059 to
8d38c52
Compare
metactc
added a commit
to metactc/Ax
that referenced
this pull request
Mar 19, 2026
Summary: Pull Request resolved: facebook#5025 Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage. = Background ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused. = Solution This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective. = Motivation This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail. **Note:** The SQA (database) store already handles this type; the JSON store was the only gap. Reviewed By: bletham Differential Revision: D96486632
8d38c52 to
884d91a
Compare
Summary: Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage. = Background ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused. = Solution This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective. = Motivation This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail. **Note:** The SQA (database) store already handles this type; the JSON store was the only gap. Reviewed By: bletham Differential Revision: D96486632
884d91a to
034ea82
Compare
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.
Summary:
Adds JSON serialization/deserialization support for ScalarizedOutcomeConstraint in Ax's JSON storage.
= Background
ScalarizedOutcomeConstraint differs from OutcomeConstraint in that it holds a list of metrics and weights instead of a single metric. Accessing .metric on a ScalarizedOutcomeConstraint raises NotImplementedError, so the existing outcome_constraint_to_dict encoder cannot be reused.
= Solution
This diff implements a dedicated encoder (scalarized_outcome_constraint_to_dict) following the same pattern as ScalarizedObjective.
= Motivation
This issue was discovered when serializing an experiment loaded from the Ax DB via object_to_json. The experiment's historical GeneratorRun objects contained ScalarizedOutcomeConstraint instances (set by Bayesian optimization), which caused serialization to fail.
Note: The SQA (database) store already handles this type; the JSON store was the only gap.
Reviewed By: bletham
Differential Revision: D96486632