Skip to content

Commit

Permalink
Fixed a bug that could result in unsat terminal nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
mondokm committed Feb 21, 2024
1 parent 8548ad0 commit ef9dfaa
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,20 @@ public MddNode get(int key) {
} else {
final Expr<BoolType> canonizedExpr = ExprUtils.canonize(ExprUtils.simplify(simplifiedExpr));
MddGraph<Expr> mddGraph = (MddGraph<Expr>) mddVariable.getMddGraph();
childNode = canonizedExpr instanceof FalseExpr ? mddGraph.getTerminalZeroNode() : mddGraph.getNodeFor(canonizedExpr);

if (canonizedExpr instanceof FalseExpr) {
childNode = mddGraph.getTerminalZeroNode();
} else {
var solver = solverPool.requestSolver();
try (var wpp = new WithPushPop(solver)) {
solver.add(canonizedExpr);
if (solver.check().isSat()) {
childNode = mddGraph.getNodeFor(canonizedExpr);
} else {
childNode = mddGraph.getTerminalZeroNode();
}
}
}
}

if (!childNode.equals(mddVariable.getMddGraph().getTerminalZeroNode()))
Expand Down

0 comments on commit ef9dfaa

Please sign in to comment.