Enforce optimization constraints and show their verdicts in the study view - #9604
Draft
kube wants to merge 4 commits into
Draft
Enforce optimization constraints and show their verdicts in the study view#9604kube wants to merge 4 commits into
kube wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
kube
added this pull request to stack #9549
September 9, 2026 05:07
kube
force-pushed
the
claude/opt-proto-constraints
branch
from
September 9, 2026 13:32
9e4834d to
db7b45b
Compare
kube
force-pushed
the
claude/opt-proto-constraints
branch
from
September 9, 2026 13:51
db7b45b to
623ab76
Compare
…nd carry them on browser trial events
…s as per-run indicator metrics
…ps clear stat, a Runs passed column and greyed infeasible draws
…ecture page, with changesets
kube
force-pushed
the
claude/opt-proto-constraints
branch
from
September 9, 2026 18:38
623ab76 to
4005ece
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.
Important
Experimental
Behind the In-browser optimization feature flag.
Summary
Before this PR, a study recorded its constraints and nothing evaluated them. Every draw the optimizer proposed was simulated, every run counted the same, and the study view had no word on feasibility.
This PR evaluates constraints for a study run in the browser. A parameter constraint is checked before a step simulates: a negative margin prunes the step as infeasible with the constraint named, and the step draws grey in the steps table, on the surface and on the objective chart. A state constraint compiles to a 0/1 indicator metric whose minimum over time says whether a run held it throughout, and the trial event carries runs passed over runs total per constraint. The study view gains a Constraints card, a Steps clear stat and a Runs passed column, every rate printed as a raw fraction beside its percentage, and the create drawer gains a Pass threshold. The objective stays the plain mean over every run; verdicts sit beside it and exclude nothing.
Links
Changes
Core
constraintMarginwalks a constraint's HIR and gives its signed slack at a pointcompileStateConstraintIndicatorcompiles a state constraint as abody ? 1 : 0metricgetRunValueshonoursaggregateTimefor scalar outputconstraintPolicyand trial eventconstraintsChannel
trialOutcomeattaches{ parameters, state }beside the plain meanStudy view
constraint-rates.tsderives every rate from the trials in renderKnown issues
Next steps
marginForOptunaAutoStudyharnessconstraintslist for the real Pyodide storyTest coverage
margin.test.ts,indicator-metric.test.ts:user-defined.test.ts,optimization.test.ts,browser-optimization.test.ts:trial-constraints.test.ts,create-optimization-channel.test.ts,detached-objective.test.ts:constraint-rates.test.ts,objective-history-data.test.ts,surface-plot.test.tsx:create-optimization-drawer.test.tsx,view-optimization-drawer.test.tsx:How to test
Profit, direction Maximize, tick Optimize production_ratescenario.production_rate <= 320return state.places.FinishedGoods.count <= 500;