Skip to content

(feature): adds API on Constraint to get var ids#235

Merged
adamchalmers merged 2 commits intomainfrom
tsk-extract-var-ids
Mar 31, 2026
Merged

(feature): adds API on Constraint to get var ids#235
adamchalmers merged 2 commits intomainfrom
tsk-extract-var-ids

Conversation

@therapon
Copy link
Copy Markdown
Contributor

Adds two new methods on Constraint that provide the variables IDs for a constraint

  • extend_dependent_variable_ids(self, Extend<Id>). Extends the passed collection to include variable Ids that change the constraint's residual values. Var Ids that affect the constraint only.

  • extend_associated_variable_ids(self, Extend<Id>). Extends the passed collection to include variable Ids associated with the constraint--both those that affect the residual and those that do not.

Closes: #234

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 66.84211% with 63 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.37%. Comparing base (ceba35e) to head (92f1752).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ezpz/src/constraints.rs 66.84% 63 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #235      +/-   ##
==========================================
- Coverage   90.86%   90.37%   -0.50%     
==========================================
  Files          23       23              
  Lines        5025     5215     +190     
==========================================
+ Hits         4566     4713     +147     
- Misses        459      502      +43     
Flag Coverage Δ
unittests 90.37% <66.84%> (-0.50%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 30, 2026

Merging this PR will not alter performance

✅ 8 untouched benchmarks
⏩ 16 skipped benchmarks1


Comparing tsk-extract-var-ids (92f1752) with main (ceba35e)

Open in CodSpeed

Footnotes

  1. 16 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

pub fn extend_dependent_variable_ids(&self, out: &mut impl Extend<Id>) {
match self {
Constraint::LineTangentToCircle(line, circle) => {
out.extend(line.all_variables());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this basically going to be computing the exact same data as Constraint::nonzeroes, but collecting into a single collection rather than multiple (row0, row1, row2 etc)?

If so, let's either
A. deduplicate them, so there's only one place that says which IDs can alter the residual
B. Have a property-based test (we use proptest elsewhere in this codebase) that asserts the invariant that extend_dependent_variable_ids should return the same IDs as nonzeroes for any constraint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going with B for now and leaving A as a follow up.

For A the the refactor would need an internal helper function that both public APIs will call. I'll make an issue for it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #236

@therapon therapon self-assigned this Mar 31, 2026
@adamchalmers adamchalmers merged commit 90a4512 into main Mar 31, 2026
12 of 13 checks passed
@adamchalmers adamchalmers deleted the tsk-extract-var-ids branch March 31, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract variable IDs from constraint

2 participants