wmpy.enumeration.asynchronous.AsyncWrapper

class AsyncWrapper(enumerator, max_queue_size=0)[source]

Bases: Enumerator

This class implements a wrapper around an arbitrary Enumerator. The enclosed enumerator will run on a separate thread, enabling asychronous execution.

Default constructor.

Parameters:
  • enumerator (Enumerator) – the enclosed Enumerator

  • max_queue_size (int) – maximum number of assignments to compute in parallel

Methods

enumerate

Enumerates (possibly partial) truth assignments for the given formula using the enclosed enumerator.

Attributes

env

support

weights

enumerate(query)[source]

Enumerates (possibly partial) truth assignments for the given formula using the enclosed enumerator.

The class attribute max_queue_size controls the size of the queue, regulating how many truth assignments can be enumerated without further processing.

Parameters:

query (FNode) – the query as a pysmt formula

Returns:

  • TA is a dictionary {pysmt_atom : bool} representing (partial) truth assignment

  • NB is a non-negative integer representing the number of unassigned Boolean variables

Return type:

An iterable of tuples <TA, NB> where