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 calls terminate() to determine whether the query should be terminated. If terminate() returns True , the query is terminated as if a resource limit had been reached. For queries that return a Result , the result is unknown with explanation UnknownExplanation.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, pressing Ctrl-C while a query is executed raises a KeyboardInterrupt in terminate() , 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 while terminate() is executed. This allows to terminate a query from another thread, e.g., by setting a threading.Event that is checked in terminate() .

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.