Class AbstractUserPropagator
- All Implemented Interfaces:
UserPropagator
- Direct Known Subclasses:
NQueensEnumeratingPropagator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PropagatorBackendvoidinitializeWithBackend(PropagatorBackend pBackend) This method is invoked after the user propagator is registered viaBasicProverEnvironment.registerUserPropagator(UserPropagator).voidonDecision(BooleanFormula expr, boolean value) This callback is invoked if the solver decides to branch on a registered expression.voidThis callback is invoked when the solver finds a complete satisfying assignment.voidonKnownValue(BooleanFormula expr, boolean value) This callback is invoked if the solver gets to know the value of a registered expression (UserPropagator.registerExpression(org.sosy_lab.java_smt.api.BooleanFormula)).voidonPop(int numPoppedLevels) This callback is invoked when the solver backtracks.voidonPush()This callback is invoked whenever the solver creates a new decision level.voidregisterExpression(BooleanFormula theoryExpr) Registers an expression to be observed by theUserPropagator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sosy_lab.java_smt.api.UserPropagator
onBinding
-
Constructor Details
-
AbstractUserPropagator
public AbstractUserPropagator()
-
-
Method Details
-
getBackend
-
onPush
public void onPush()Description copied from interface:UserPropagatorThis callback is invoked whenever the solver creates a new decision level. A user propagator should maintain backtracking points on each push to enable later backtracking.The onPush or onPop operation refers to internal state of the SMT/SAT solver while running a SAT check. This does not relate to Prover operations in the SMT-based API, such as
BasicProverEnvironment.push(org.sosy_lab.java_smt.api.BooleanFormula)orBasicProverEnvironment.pop().- Specified by:
onPushin interfaceUserPropagator
-
onPop
public void onPop(int numPoppedLevels) Description copied from interface:UserPropagatorThis callback is invoked when the solver backtracks. The solver can backtrack multiple levels simultaneously.The onPush or onPop operation refers to internal state of the SMT/SAT solver while running a SAT check. This does not relate to Prover operations in the SMT-based API, such as
BasicProverEnvironment.push(org.sosy_lab.java_smt.api.BooleanFormula)orBasicProverEnvironment.pop().- Specified by:
onPopin interfaceUserPropagator- Parameters:
numPoppedLevels- The number of levels to backtrack (~ number of pushes to backtrack).
-
onFinalCheck
public void onFinalCheck()Description copied from interface:UserPropagatorThis callback is invoked when the solver finds a complete satisfying assignment. The user can check the found model for consistency and potentially raise conflicts viaPropagatorBackend.propagateConflict(BooleanFormula[]).Note: This callback is only invoked if the user propagator enabled it via
PropagatorBackend.notifyOnFinalCheck().- Specified by:
onFinalCheckin interfaceUserPropagator
-
onKnownValue
Description copied from interface:UserPropagatorThis callback is invoked if the solver gets to know the value of a registered expression (UserPropagator.registerExpression(org.sosy_lab.java_smt.api.BooleanFormula)). Within the callback, the user can raise conflicts viaPropagatorBackend.propagateConflict(org.sosy_lab.java_smt.api.BooleanFormula[]), propagate consequences viaPropagatorBackend.propagateConsequence(org.sosy_lab.java_smt.api.BooleanFormula[], org.sosy_lab.java_smt.api.BooleanFormula), or influence the solvers decision heuristics viaPropagatorBackend.propagateNextDecision(org.sosy_lab.java_smt.api.BooleanFormula, java.util.Optional<java.lang.Boolean>).The reported value is only known on the current and later push levels, but will get invalidated when backtracking.
Note: This callback is only invoked if the user propagator enabled it via
PropagatorBackend.notifyOnKnownValue().- Specified by:
onKnownValuein interfaceUserPropagator- Parameters:
expr- The expressions whose value is known.value- The value of the expression.
-
onDecision
Description copied from interface:UserPropagatorThis callback is invoked if the solver decides to branch on a registered expression. (UserPropagator.registerExpression(org.sosy_lab.java_smt.api.BooleanFormula)). Within the callback, the user can change the decision by callingPropagatorBackend.propagateNextDecision(org.sosy_lab.java_smt.api.BooleanFormula, java.util.Optional<java.lang.Boolean>).Note: This callback is only invoked if the user propagator enabled it via
PropagatorBackend.notifyOnDecision().- Specified by:
onDecisionin interfaceUserPropagator- Parameters:
expr- The expressions whose value gets decided (usually a literal).value- The decision value.
-
initializeWithBackend
Description copied from interface:UserPropagatorThis method is invoked after the user propagator is registered viaBasicProverEnvironment.registerUserPropagator(UserPropagator). The user can enable notifications by accessing the providedPropagatorBackend.Warning: During its lifetime, a user propagator shall only be registered once via
BasicProverEnvironment.registerUserPropagator(UserPropagator)for otherwise unexpected errors can occur. Implementations are advised to throw exceptions if this method is called multiple times.- Specified by:
initializeWithBackendin interfaceUserPropagator
-
registerExpression
Description copied from interface:UserPropagatorRegisters an expression to be observed by theUserPropagator. Solver actions related to the expression are reported:- The callback
UserPropagator.onKnownValue(org.sosy_lab.java_smt.api.BooleanFormula, boolean)gets invoked if the value of a registered expression becomes known (if notification was enabled viaPropagatorBackend.notifyOnKnownValue()). - The callback
UserPropagator.onDecision(org.sosy_lab.java_smt.api.BooleanFormula, boolean)gets invoked right before the solver decides on the value of a registered expression (if notification was enabled viaPropagatorBackend.notifyOnDecision()).
- Specified by:
registerExpressionin interfaceUserPropagator- Parameters:
theoryExpr- The expression to observe.
- The callback
-