Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Style compiler cleanup #971

Merged
merged 12 commits into from May 16, 2022
Merged

refactor: Style compiler cleanup #971

merged 12 commits into from May 16, 2022

Conversation

wodeni
Copy link
Member

@wodeni wodeni commented May 13, 2022

Description

Related issue/PR: #888

This PR refactors multiple modules related to the Style compiler to prepare for the rewrite.

Implementation strategy and design decisions

  • Add Opt and CompGraph back to @penrose/browser-ui back for debugging
  • Organize Style.ts
  • Delete any dead code
  • Clean up State and remove unused properties
  • Refactor evalFns: the original version generates code (i.e. calls genCode) for every single objective and constraint. This PR adds secondary outputs that are intermediate nodes in the optimization graph. Retrieving the energy values of those functions is a matter of pulling the secondary outputs out of the graph.

Examples with steps to reproduce them

This PR adds Opt back, which reports the energy values of individual constraints and objectives:

image

Note that this view doesn't report the gradients for objectives. See comment here:

// COMBAK: objective gradient norms are currently deprecated, because the

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new ESLint warnings
  • I have reviewed any generated changes to the diagrams/ folder

@wodeni wodeni marked this pull request as draft May 13, 2022 17:56
@cloudflare-pages
Copy link

cloudflare-pages bot commented May 13, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: f1b00e1
Status: ✅  Deploy successful!
Preview URL: https://6eaecad7.penrose-panes.pages.dev

View logs

@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #971 (f1b00e1) into main (054e57f) will decrease coverage by 0.38%.
The diff coverage is 91.08%.

@@            Coverage Diff             @@
##             main     #971      +/-   ##
==========================================
- Coverage   63.52%   63.13%   -0.39%     
==========================================
  Files          62       62              
  Lines        7909     7813      -96     
  Branches     1830     1814      -16     
==========================================
- Hits         5024     4933      -91     
+ Misses       2766     2762       -4     
+ Partials      119      118       -1     
Impacted Files Coverage Δ
packages/core/src/engine/EngineUtils.ts 62.75% <ø> (-2.29%) ⬇️
packages/core/src/types/ad.ts 100.00% <ø> (ø)
packages/core/src/utils/Util.ts 58.33% <87.50%> (+3.55%) ⬆️
packages/core/src/compiler/Style.ts 78.29% <90.90%> (-0.60%) ⬇️
packages/core/src/engine/Optimizer.ts 80.97% <92.85%> (-1.55%) ⬇️
packages/core/src/engine/Autodiff.ts 81.85% <100.00%> (ø)
packages/core/src/engine/Evaluator.ts 33.51% <100.00%> (+0.17%) ⬆️
packages/core/src/index.ts 69.11% <100.00%> (-0.96%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 054e57f...f1b00e1. Read the comment docs.

@wodeni wodeni changed the title feat: Style compiler rewrite refactor: Style compiler cleanup May 13, 2022
@wodeni wodeni marked this pull request as ready for review May 16, 2022 15:41
@wodeni wodeni merged commit 012aec1 into main May 16, 2022
@wodeni wodeni deleted the sty-compiler-rewrite branch May 16, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants