Terminator
This class encapsulates a user-specified terminator, which allows to terminate
queries of a solver.
It is configured via
cvc5.Solver.setTerminator()
.
- class cvc5. Terminator
-
A cvc5 terminator, which allows to terminate queries of a solver.
Wrapper class for
cvc5::Terminator.A terminator is connected to a solver via
Solver.setTerminator(). While the solver executes a query (e.g.,Solver.checkSat()), it periodically callsterminate()to determine whether the query should be terminated. Ifterminate()returnsTrue, the query is terminated as if a resource limit had been reached. For queries that return aResult, the result is unknown with explanationUnknownExplanation.INTERRUPTED.A termination request only applies to the query during which it was issued, and the solver can be used for further queries afterwards.
If
terminate()raises an exception, the query is terminated and the exception is re-raised by the method that executed the query. For example, pressingCtrl-Cwhile a query is executed raises aKeyboardInterruptinterminate(), which thus terminates the query.Method
terminate()is called from the thread that executes the query. Queries do not release the GIL, but other Python threads get to run whileterminate()is executed. This allows to terminate a query from another thread, e.g., by setting athreading.Eventthat is checked interminate().Warning
This class is experimental and may change in future versions.
- terminate ( )
-
Determine whether the current query of the solver this terminator is connected to should be terminated.
- Returns :
-
True to terminate the current query.