Skip to content

feat: add use_constants option to disable real constants#576

Open
MilesCranmerBot wants to merge 3 commits intoastroautomata:masterfrom
MilesCranmerBot:feat/use-constants-backend
Open

feat: add use_constants option to disable real constants#576
MilesCranmerBot wants to merge 3 commits intoastroautomata:masterfrom
MilesCranmerBot:feat/use-constants-backend

Conversation

@MilesCranmerBot
Copy link
Copy Markdown
Contributor

@MilesCranmerBot MilesCranmerBot commented Feb 20, 2026

Summary

  • add use_constants (default true) to backend Options
  • when use_constants=false, random leaf generation no longer creates real-valued constants
  • disable constant-specific operations when constants are disabled:
    • should_optimize_constants = false
    • probability_negate_constant = 0.0
    • mutation weights mutate_constant and optimize forced to 0.0
  • include use_constants in warm-start incompatibility checks
  • add unit test coverage for these behaviors

Validation

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 20, 2026

Benchmark Results (Julia v1)

Time benchmarks
master d74f183... master / d74f183...
search/multithreading 16.4 ± 0.24 s 15.7 ± 0.2 s 1.04 ± 0.02
search/serial 35.7 ± 0.37 s 34 ± 0.35 s 1.05 ± 0.015
utils/best_of_sample 1.82 ± 0.57 μs 1.81 ± 0.51 μs 1.01 ± 0.42
utils/check_constraints_x10 16.9 ± 4.4 μs 16.8 ± 4.2 μs 1 ± 0.36
utils/compute_complexity_x10/Float64 2.15 ± 0.09 μs 2.14 ± 0.09 μs 1 ± 0.06
utils/compute_complexity_x10/Int64 2.05 ± 0.09 μs 2.04 ± 0.09 μs 1 ± 0.062
utils/compute_complexity_x10/nothing 1.5 ± 0.08 μs 1.51 ± 0.081 μs 0.994 ± 0.075
utils/insert_random_op_x10 5.5 ± 1.7 μs 5.18 ± 1.7 μs 1.06 ± 0.47
utils/next_generation_x100 0.439 ± 0.022 ms 0.434 ± 0.022 ms 1.01 ± 0.072
utils/optimize_constants_x10 0.0386 ± 0.008 s 0.0361 ± 0.0078 s 1.07 ± 0.32
utils/randomly_rotate_tree_x10 8.5 ± 1 μs 8.38 ± 0.98 μs 1.01 ± 0.17
time_to_load 2.82 ± 0.025 s 2.75 ± 0.071 s 1.02 ± 0.028
Memory benchmarks
master d74f183... master / d74f183...
search/multithreading 0.205 G allocs: 53.4 GB 0.204 G allocs: 53.5 GB 0.998
search/serial 0.207 G allocs: 53.8 GB 0.207 G allocs: 53.8 GB 1
utils/best_of_sample 0.038 k allocs: 3.25 kB 0.038 k allocs: 3.25 kB 1
utils/check_constraints_x10 0.034 k allocs: 0.875 kB 0.034 k allocs: 0.875 kB 1
utils/compute_complexity_x10/Float64 0 allocs: 0 B 0 allocs: 0 B
utils/compute_complexity_x10/Int64 0 allocs: 0 B 0 allocs: 0 B
utils/compute_complexity_x10/nothing 0 allocs: 0 B 0 allocs: 0 B
utils/insert_random_op_x10 0.046 k allocs: 1.94 kB 0.041 k allocs: 1.62 kB 1.19
utils/next_generation_x100 4.62 k allocs: 0.276 MB 4.63 k allocs: 0.276 MB 1
utils/optimize_constants_x10 25 k allocs: 25.7 MB 24.5 k allocs: 25.4 MB 1.01
utils/randomly_rotate_tree_x10 0.042 k allocs: 1.34 kB 0.042 k allocs: 1.34 kB 1
time_to_load 0.15 k allocs: 11.2 kB 0.145 k allocs: 11 kB 1.02

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 47.61905% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.77%. Comparing base (9c6460e) to head (d74f183).

Files with missing lines Patch % Lines
src/ParametricExpression.jl 8.33% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #576      +/-   ##
==========================================
- Coverage   94.97%   94.77%   -0.21%     
==========================================
  Files          42       42              
  Lines        3883     3904      +21     
==========================================
+ Hits         3688     3700      +12     
- Misses        195      204       +9     

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

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