Support perfect-segment (horizontal/vertical) curve intersections in Equilibrium#162
Draft
alexanderthclark wants to merge 1 commit into
Draft
Conversation
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.
Motivation
Equilibrium.__init__) which prevented valid intersections from being computed; the goal is to handle common perfect-segment combinations instead of blocking them.Equilibrium._compute/_find_intersectioncan return a deterministic(p, q)when the geometry uniquely pins an outcome.Description
Equilibrium.__init__so curves with perfect segments may be used.Equilibrium._solve_with_perfect_segments(dcurve, scurve)that inspects piece combinations and handles: horizontal vs regular, vertical vs regular, and horizontal vs vertical cases, collecting candidate(p,q)solutions and returning a unique deterministic pair when possible.Equilibrium._find_intersectionto run before the regular piecewise intersection loop and preserved the affine fallback behavior for ordinary cases."economically indeterminate quantity at fixed price"for price-equal horizontal pairs and"unsupported combination: ..."for other unhandled perfect-segment pairings or multiple distinct perfect-segment intersections._valid_in_domainorientation-safe by usingmin/maxon piece domains so intersections validate correctly regardless of domain ordering.tests/test_horizontal_curves.pyto reflect supported perfect-segment outcomes and the new indeterminate error case.Testing
pytest -q tests/test_horizontal_curves.py tests/test_equilibrium.py tests/test_world_price.pyand all tests passed (15 passed).Codex Task