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

feat: added swap-in mutator #646

Merged
merged 6 commits into from Feb 6, 2022
Merged

feat: added swap-in mutator #646

merged 6 commits into from Feb 6, 2022

Conversation

hsharriman
Copy link
Contributor

@hsharriman hsharriman commented Aug 18, 2021

Description

Added a new mutator to the synthesizer called the swap-in mutator. For any predicate, function, or constructor, this mutator will replace one of the statement's arguments with another random variable of the same type that is in scope. For instance:

Set, A, B, C
IsSubset(B, A)

A valid Swap-in mutation would be IsSubset(B, A) -> IsSubset(B, C). Note that IsSubset(B, B) is not a valid swap because the argument is already included.

Implementation strategy and design decisions

Builds upon Nimo's refactor of the synthesis module.

Examples with steps to reproduce them

  • checkout branch, yarn start from root
  • yarn set-example from packages/synthesizer
  • yarn generate-site from packages/automator
  • load the generated index.html in your browser

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass locally using yarn test
  • I ran yarn docs and there were no errors when generating the HTML site
  • My code follows the style guidelines of this project (e.g.: no ESLint warnings)

Open questions

@hsharriman hsharriman requested a review from wodeni August 18, 2021 23:58
@codecov
Copy link

codecov bot commented Aug 18, 2021

Codecov Report

Merging #646 (166b610) into main (7c7f6b3) will decrease coverage by 0.71%.
The diff coverage is 3.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #646      +/-   ##
==========================================
- Coverage   68.22%   67.50%   -0.72%     
==========================================
  Files          62       62              
  Lines        8062     8208     +146     
  Branches     1812     1775      -37     
==========================================
+ Hits         5500     5541      +41     
- Misses       2482     2660     +178     
+ Partials       80        7      -73     
Impacted Files Coverage Δ
packages/core/src/synthesis/Synthesizer.ts 19.20% <0.00%> (-0.70%) ⬇️
packages/core/src/synthesis/Mutation.ts 18.68% <4.16%> (-4.65%) ⬇️
packages/core/src/analysis/SubstanceAnalysis.ts 49.68% <7.14%> (-3.79%) ⬇️
packages/core/src/renderer/Text.ts 16.66% <0.00%> (-73.34%) ⬇️
packages/core/src/shapes/Text.ts 60.00% <0.00%> (-40.00%) ⬇️
packages/core/src/utils/CollectLabels.ts 66.66% <0.00%> (-22.23%) ⬇️
packages/core/src/renderer/AttrHelper.ts 74.69% <0.00%> (-7.23%) ⬇️
packages/core/src/engine/PropagateUpdate.ts 31.81% <0.00%> (-6.07%) ⬇️
packages/core/src/contrib/Objectives.ts 48.14% <0.00%> (-3.71%) ⬇️
packages/core/src/shapes/Samplers.ts 92.30% <0.00%> (-1.98%) ⬇️
... and 36 more

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 7c7f6b3...166b610. Read the comment docs.

Copy link
Member

@wodeni wodeni left a comment

Choose a reason for hiding this comment

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

Overall looks great to me! Just a minor point about finding IDs of the same type below.

Hopefully the refactored version made things easier to implement :D.

packages/core/src/analysis/SubstanceAnalysis.ts Outdated Show resolved Hide resolved
@netlify
Copy link

netlify bot commented Jan 25, 2022

✔️ Deploy Preview for penrose-saurus ready!

🔨 Explore the source changes: 4b52b0d

🔍 Inspect the deploy log: https://app.netlify.com/sites/penrose-saurus/deploys/61f81a829296ac0007a64d46

😎 Browse the preview: https://deploy-preview-646--penrose-saurus.netlify.app

@cloudflare-pages
Copy link

cloudflare-pages bot commented Jan 31, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 166b610
Status: ✅  Deploy successful!
Preview URL: https://ae45d359.penrose-panes.pages.dev

View logs

… a statement before picking an argument to swap-in, addressed feedback
Copy link
Member

@wodeni wodeni left a comment

Choose a reason for hiding this comment

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

The new changes look good to me! Please feel free to merge whenever you think this is ready.

@hsharriman hsharriman merged commit 71b872b into main Feb 6, 2022
@hsharriman hsharriman deleted the swap-in-mutator branch February 6, 2022 03:41
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.

None yet

2 participants