Skip to content

Comments

[Do not merge] Replace Polynomial/poly! with symbolic expression system#69

Draft
isPANN wants to merge 8 commits intomainfrom
symbolic-expr-design
Draft

[Do not merge] Replace Polynomial/poly! with symbolic expression system#69
isPANN wants to merge 8 commits intomainfrom
symbolic-expr-design

Conversation

@isPANN
Copy link
Collaborator

@isPANN isPANN commented Feb 14, 2026

Summary

  • Added src/expr.rs: symbolic expression system with AST, Pratt parser, evaluator, Display, and Serde (string round-tripping)
  • Migrated all 30 reduction files from poly! macro to string expression literals (e.g., "3 * n ^ 2 + m")
  • Migrated ReductionOverhead, export system, cost functions, and graph module to use Expr
  • Deleted src/polynomial.rs and poly! macro (replaced entirely by Expr)

What Changed

The overhead DSL now supports arbitrary expressions beyond polynomials: exponentiation with non-integer bases (1.44 ^ n), built-in functions (log2, sqrt, min, max, floor, ceil), and full arithmetic. Expressions are parsed from string literals at construction time and serialize as strings in JSON.

Test Plan

  • All 1468 lib tests pass
  • All 47 doc tests pass
  • Clippy clean (no warnings)
  • Formatting clean
  • Examples compile and run
  • Reduction graph JSON regenerated successfully

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 84.80447% with 136 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.96%. Comparing base (f3d42d5) to head (b6681ba).

Files with missing lines Patch % Lines
src/expr.rs 81.37% 87 Missing ⚠️
src/rules/cost.rs 17.14% 29 Missing ⚠️
src/rules/graph.rs 68.18% 7 Missing ⚠️
src/rules/registry.rs 84.21% 6 Missing ⚠️
src/rules/coloring_qubo.rs 0.00% 1 Missing ⚠️
src/rules/ilp_qubo.rs 0.00% 1 Missing ⚠️
src/rules/ksatisfiability_qubo.rs 0.00% 1 Missing ⚠️
src/rules/maximumindependentset_qubo.rs 0.00% 1 Missing ⚠️
src/rules/maximumsetpacking_qubo.rs 0.00% 1 Missing ⚠️
src/rules/minimumvertexcover_qubo.rs 0.00% 1 Missing ⚠️
... and 1 more

❌ Your patch check has failed because the patch coverage (84.80%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
- Coverage   96.36%   95.96%   -0.41%     
==========================================
  Files         197      197              
  Lines       27210    27676     +466     
==========================================
+ Hits        26222    26560     +338     
- Misses        988     1116     +128     

☔ 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.

@isPANN isPANN marked this pull request as draft February 15, 2026 12:39
@isPANN isPANN force-pushed the symbolic-expr-design branch from 59817b2 to 9fbca74 Compare February 21, 2026 05:34
@isPANN isPANN force-pushed the symbolic-expr-design branch from 9fbca74 to b6681ba Compare February 21, 2026 15:26
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.

1 participant