@@ -12,7 +12,11 @@ A high-performance Julia package for solving Boolean satisfiability problems usi
1212- ** Tensor Network Representation** : Efficiently represents Boolean satisfiability problems as tensor networks
1313- ** Optimal Branching** : Uses advanced branching strategies to minimize search space
1414- ** Multiple Problem Types** : Supports CNF, circuit, and factoring problems
15+ - ** Circuit Simplification** : Automatic circuit simplification using constant propagation and gate optimization
16+ - ** CDCL Integration** : Supports clause learning via CaDiCaL SAT solver integration
17+ - ** 2-SAT Solver** : Built-in efficient 2-SAT solver for special cases
1518- ** High Performance** : Optimized for speed with efficient propagation and contraction algorithms
19+ - ** Visualization** : Problem structure visualization with graph-based representations
1620- ** Flexible Interface** : Easy-to-use API for various constraint satisfaction problems
1721
1822## Installation
@@ -36,7 +40,7 @@ cnf = ∧(∨(a, b, ¬d, ¬e), ∨(¬a, d, e, ¬f), ∨(f, g), ∨(¬b, c), ∨(
3640
3741# Solve and get assignments
3842sat = Satisfiability (cnf; use_constraints= true )
39- satisfiable, assignments, depth = solve_sat_with_assignments (sat)
43+ satisfiable, assignments, stats = solve_sat_with_assignments (sat)
4044
4145println (" Satisfiable: " , satisfiable)
4246println (" Assignments: " , assignments)
@@ -46,69 +50,144 @@ println("Assignments: ", assignments)
4650
4751``` julia
4852# Factor a semiprime number
49- a, b = solve_factoring (5 , 5 , 31 * 29 )
53+ a, b, stats = solve_factoring (5 , 5 , 31 * 29 )
5054println (" Factors: $a × $b = $(a* b) " )
5155```
5256
53- ### Circuit Problems
57+ ### Circuit SAT Problems
5458
5559``` julia
60+ using ProblemReductions: Circuit, Assignment, BooleanExpr
61+
5662# Solve circuit satisfiability
5763circuit = @circuit begin
5864 c = x ∧ y
5965end
6066push! (circuit. exprs, Assignment ([:c ], BooleanExpr (true )))
6167
62- tnproblem = setup_from_circuit (circuit)
63- result, depth = solve (tnproblem, BranchingStrategy (), NoReducer ())
68+ satisfiable, stats = solve_circuit_sat (circuit)
6469```
6570
6671## Core Components
6772
6873### Problem Types
69- - ` TNProblem ` : Main problem representation
70- - ` BipartiteGraph ` : Static problem structure
71- - ` DomainMask ` : Variable domain representation
72-
73- ### Solvers
74- - ` TNContractionSolver ` : Tensor network contraction-based solver
75- - ` LeastOccurrenceSelector ` : Variable selection strategy
76- - ` NumUnfixedVars ` : Measurement strategy
74+ - ` TNProblem ` : Main tensor network problem representation
75+ - ` BipartiteGraph ` : Static problem structure (variables and tensors)
76+ - ` DomainMask ` : Variable domain representation using bitmasks
77+ - ` ClauseTensor ` : Clause representation as tensor factors
78+
79+ ### Solvers & Strategies
80+ - ` TNContractionSolver ` : Tensor network contraction-based branching table solver
81+ - ` MostOccurrenceSelector ` : Variable selection based on occurrence frequency
82+ - ` NumUnfixedVars ` : Measurement strategy counting unfixed variables
83+ - ` NumUnfixedTensors ` : Measurement based on unfixed tensor count
84+ - ` HardSetSize ` : Measurement based on hard clause set size
7785
7886### Key Functions
79- - ` solve() ` : Main solving function
80- - ` setup_from_cnf() ` : Setup from CNF formulas
81- - ` setup_from_circuit() ` : Setup from circuit descriptions
82- - ` solve_factoring() ` : Solve integer factoring problems
87+
88+ | Function | Description |
89+ | ----------| -------------|
90+ | ` solve() ` | Main solving function with configurable strategy |
91+ | ` solve_sat_problem() ` | Solve SAT and return satisfiability result |
92+ | ` solve_sat_with_assignments() ` | Solve SAT and return variable assignments |
93+ | ` solve_circuit_sat() ` | Solve circuit satisfiability problems |
94+ | ` solve_factoring() ` | Solve integer factoring problems |
95+ | ` setup_from_cnf() ` | Setup problem from CNF formulas |
96+ | ` setup_from_circuit() ` | Setup problem from circuit descriptions |
97+ | ` setup_from_sat() ` | Setup problem from CSP representation |
8398
8499## Advanced Usage
85100
86101### Custom Branching Strategy
87102
88103``` julia
89- using OptimalBranchingCore: BranchingStrategy
104+ using OptimalBranchingCore: BranchingStrategy, GreedyMerge
90105
91106# Configure custom solver
92107bsconfig = BranchingStrategy (
93108 table_solver= TNContractionSolver (),
94- selector= LeastOccurrenceSelector (2 , 10 ),
95- measure= NumUnfixedVars ()
109+ selector= MostOccurrenceSelector (3 , 4 ),
110+ measure= NumUnfixedTensors (),
111+ set_cover_solver= GreedyMerge ()
96112)
97113
98114# Solve with custom configuration
99- result, depth = solve (problem, bsconfig, NoReducer ())
115+ result = solve (problem, bsconfig, NoReducer ())
100116```
101117
102- ### Benchmarking
118+ ### Circuit Simplification
119+
120+ ``` julia
121+ using ProblemReductions: CircuitSAT
122+
123+ # Simplify a circuit before solving
124+ simplified_circuit, var_mapping = simplify_circuit (circuit, fixed_vars)
125+ ```
103126
104- The package includes comprehensive benchmarking tools:
127+ ### 2-SAT Solving
105128
106129``` julia
107- using BooleanInferenceBenchmarks
130+ # Check if problem is 2-SAT reducible and solve
131+ if is_2sat_reducible (problem)
132+ result = solve_2sat (problem)
133+ end
134+ ```
108135
109- # Compare different solvers
110- configs = [(10 ,10 ), (12 ,12 ), (14 ,14 )]
111- results = run_solver_comparison (FactoringProblem, configs)
112- print_solver_comparison_summary (results)
136+ ### CDCL with Clause Learning
137+
138+ ``` julia
139+ # Solve using CaDiCaL and mine learned clauses
140+ status, model, learned_clauses = solve_and_mine (cnf; conflict_limit= 30000 , max_len= 5 )
113141```
114142
143+ ### Visualization
144+
145+ ``` julia
146+ # Visualize the problem structure
147+ visualize_problem (problem, " output.png" )
148+
149+ # Get and visualize highest degree variables
150+ high_degree_vars = get_highest_degree_variables (problem, k= 10 )
151+ visualize_highest_degree_vars (problem, k= 10 , " high_degree.png" )
152+ ```
153+
154+ ## Project Structure
155+
156+ ```
157+ src/
158+ ├── BooleanInference.jl # Main module
159+ ├── interface.jl # High-level API functions
160+ ├── core/ # Core data structures
161+ │ ├── static.jl # BipartiteGraph structure
162+ │ ├── domain.jl # DomainMask operations
163+ │ ├── problem.jl # TNProblem definition
164+ │ └── stats.jl # BranchingStats tracking
165+ ├── branching/ # Branching algorithms
166+ │ ├── branch.jl # Main branching logic (bbsat!)
167+ │ ├── propagate.jl # Constraint propagation
168+ │ └── measure.jl # Measure strategies
169+ ├── branch_table/ # Branching table generation
170+ │ ├── contraction.jl # Tensor contraction
171+ │ ├── selector.jl # Variable selection
172+ │ └── branchtable.jl # Table generation
173+ ├── utils/ # Utility functions
174+ │ ├── simplify_circuit.jl # Circuit simplification
175+ │ ├── circuit2cnf.jl # Circuit to CNF conversion
176+ │ ├── twosat.jl # 2-SAT solver
177+ │ └── visualization.jl # Problem visualization
178+ └── cdcl/ # CDCL integration
179+ └── CaDiCaLMiner.jl # CaDiCaL wrapper for clause learning
180+ ```
181+
182+ ## Dependencies
183+
184+ Key dependencies include:
185+ - [ GenericTensorNetworks.jl] ( https://github.com/QuEraComputing/GenericTensorNetworks.jl ) - Tensor network operations
186+ - [ OptimalBranchingCore.jl] ( https://github.com/OptimalBranching/OptimalBranchingCore.jl ) - Branching framework
187+ - [ ProblemReductions.jl] ( https://github.com/GiggleLiu/ProblemReductions.jl ) - Problem reduction utilities
188+ - [ Graphs.jl] ( https://github.com/JuliaGraphs/Graphs.jl ) - Graph data structures
189+ - [ CairoMakie.jl] ( https://github.com/MakieOrg/Makie.jl ) - Visualization
190+
191+ ## License
192+
193+ This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE ) file for details.
0 commit comments