Skip to content

Conversation

@GiggleLiu
Copy link
Owner

@GiggleLiu GiggleLiu commented Dec 6, 2024

  • Refactor the variables interface. Now variables are forced to be 1:num_variables.
  • Rewrite the SAT to 3-SAT reduction to make it more general.

@codecov
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 98.47909% with 4 lines in your changes missing coverage. Please review.

Project coverage is 94.32%. Comparing base (ea50b96) to head (d946121).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/reduction_path.jl 60.00% 2 Missing ⚠️
src/models/models.jl 98.07% 1 Missing ⚠️
src/rules/sat_3sat.jl 96.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #116      +/-   ##
==========================================
- Coverage   95.51%   94.32%   -1.20%     
==========================================
  Files          34       33       -1     
  Lines        1450     1444       -6     
==========================================
- Hits         1385     1362      -23     
- Misses         65       82      +17     

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

@GiggleLiu GiggleLiu changed the title Refactor 2.0 [WIP] Refactor 2.0 Dec 6, 2024
@GiggleLiu GiggleLiu changed the title [WIP] Refactor 2.0 Refactor 2.0 Dec 6, 2024
@GiggleLiu
Copy link
Owner Author

@c-allergic I refactored the interfaces for ConstraintSatisfactionProblem a bit so that it can be converted to tensor networks easier. Now we can use energy_terms to generate tensors.

julia> ProblemReductions.energy_terms(IndependentSet(smallgraph(:petersen)))
25-element Vector{ProblemReductions.EnergyTerm{Int64, 2, Int64, Int64}}:
 EnergyTerm
┌───┬───┬────────────┐
│ 12 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 15 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 16 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 23 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 27 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 34 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 38 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 EnergyTerm
┌───┬───┬────────────┐
│ 45 │     energy │
├───┼───┼────────────┤
│ 000 │
│ 100 │
│ 010 │
│ 113037000500 │
└───┴───┴────────────┘

 
 EnergyTerm
┌───┬────────┐
│ 3 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌───┬────────┐
│ 4 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌───┬────────┐
│ 5 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌───┬────────┐
│ 6 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌───┬────────┐
│ 7 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌───┬────────┐
│ 8 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌───┬────────┐
│ 9 │ energy │
├───┼────────┤
│ 00 │
│ 1-1 │
└───┴────────┘

 EnergyTerm
┌────┬────────┐
│ 10 │ energy │
├────┼────────┤
│  00 │
│  1-1 │
└────┴────────┘

@GiggleLiu GiggleLiu merged commit ad72d93 into main Dec 7, 2024
4 of 5 checks passed
@GiggleLiu GiggleLiu deleted the jg/refactor2 branch March 17, 2025 08:44
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.

2 participants