SimpSolver class extends the core Solver with variable elimination and formula simplification capabilities. It implements preprocessing techniques including variable elimination, subsumption, and asymmetric branching to simplify the CNF formula before solving.
Constructor and destructor
SimpSolver()
Creates a new simplifying solver instance.~SimpSolver()
Destructor for cleanup.Problem specification
newVar()
Adds a new variable to the solver.User preferred polarity for the variable.
Whether the variable should be a decision variable.
The newly created variable identifier.
releaseVar()
Releases a variable from the solver.The literal to release.
addClause()
Adds a clause to the solver. Multiple overloads available.Vector of literals forming the clause.
First literal.
Second literal.
Third literal.
Fourth literal.
Returns
false if the clause makes the formula unsatisfiable, true otherwise.addEmptyClause()
Adds the empty clause to the solver.Returns
false (makes the formula unsatisfiable).addClause_()
Adds a clause without making an internal copy.Vector of literals that will be modified.
Returns
false if unsatisfiable, true otherwise.substitute()
Replaces all occurrences of a variable with a literal.Variable to replace.
Literal to substitute in place of the variable.
Returns
false if substitution causes a contradiction, true otherwise.Variable mode
setFrozen()
Sets whether a variable can be eliminated.Variable to configure.
If
true, the variable will not be eliminated during preprocessing.Frozen variables are protected from elimination but can still be assigned and used in solving.
isEliminated()
Checks if a variable has been eliminated.Variable to check.
Returns
true if the variable has been eliminated, false otherwise.freezeVar()
Freezes a variable so it will not be eliminated.Variable to freeze.
This is an alternative interface to
setFrozen() that only freezes variables.thaw()
Thaws all frozen variables.After calling this method, previously frozen variables may be eliminated in subsequent simplification.
Solving
solve()
Searches for a satisfying assignment with optional simplification.First assumption literal.
Second assumption literal.
Third assumption literal.
Vector of assumption literals.
Whether to perform simplification before solving.
Whether to disable simplification after this solve call.
Returns
true if satisfiable, false otherwise.Setting
do_simp=true will run variable elimination and other preprocessing techniques before the main search.solveLimited()
Searches with resource constraints and optional simplification.Vector of assumption literals.
Whether to perform simplification.
Whether to disable simplification after this call.
Returns
l_True if satisfiable, l_False if unsatisfiable, l_Undef if interrupted.eliminate()
Performs variable elimination based simplification.Whether to disable elimination after this call.
Returns
false if the formula becomes unsatisfiable during elimination, true otherwise.This method eliminates variables by resolution when it does not significantly increase formula size.
Memory management
garbageCollect()
Performs garbage collection on internal storage.This overrides the base
Solver method to handle additional data structures used for simplification.Configuration parameters
Elimination and simplification options
Allows a variable elimination step to grow the formula by this many clauses.
Variables are not eliminated if resolution produces a clause longer than this limit. Set to -1 for no limit.
Do not check subsumption against clauses larger than this. Set to -1 for no limit.
Garbage collection threshold during simplification (distinct from normal solving).
Feature flags
Enable asymmetric branching to shrink clauses.
Enable redundancy checking (checks if a clause is already implied). Expensive but powerful.
Enable variable elimination.
Flag indicating whether the user needs to access the full model including eliminated variables.
If
extend_model is false, the model will only contain values for non-eliminated variables.Statistics
Number of clause merges performed during variable elimination.
Number of literals removed by asymmetric branching.
Total number of variables eliminated by preprocessing.