Skip to content

Commit

Permalink
minor SATCall refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SHildebrandt committed Apr 24, 2024
1 parent 718fa5a commit e4b6644
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/main/java/com/booleworks/logicng/solvers/sat/SATCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ public class SATCall implements AutoCloseable {

private final SATSolver solverWrapper;
private final LNGCoreSolver solver;
private final SATHandler handler;
private final List<? extends Proposition> additionalPropositions;
private final List<? extends Literal> selectionOrder;
private SolverState initialState;
private int pgOriginalClausesLength = -1;
private Tristate satState;
Expand All @@ -62,17 +59,14 @@ public class SATCall implements AutoCloseable {
final List<? extends Proposition> additionalPropositions, final List<? extends Literal> selectionOrder) {
this.solverWrapper = solverWrapper;
solver = solverWrapper.underlyingSolver();
this.handler = handler;
this.additionalPropositions = additionalPropositions;
this.selectionOrder = selectionOrder;
initAndSolve();
initAndSolve(handler, additionalPropositions, selectionOrder);
}

public static SATCallBuilder builder(final SATSolver solver) {
return new SATCallBuilder(solver);
}

private void initAndSolve() {
private void initAndSolve(final SATHandler handler, final List<? extends Proposition> additionalPropositions, final List<? extends Literal> selectionOrder) {
solver.assertNotInSatCall();
if (solver.config.proofGeneration) {
pgOriginalClausesLength = solver.pgOriginalClauses.size();
Expand Down Expand Up @@ -179,9 +173,7 @@ public void close() {
if (solver.config.proofGeneration) {
solver.pgOriginalClauses.shrinkTo(pgOriginalClausesLength);
}
if (selectionOrder != null) {
solver.setSelectionOrder(List.of());
}
solver.setSelectionOrder(List.of());
if (initialState != null) {
solver.loadState(initialState);
}
Expand Down

0 comments on commit e4b6644

Please sign in to comment.