pymzn.Solutions

class pymzn.Solutions(queue, *, keep=True)

Solution stream returned by the pymzn.minizinc function.

You should not need to instantiate this class in any other way than by calling the pymzn.minizinc or the pymzn.aio.minizinc functions. This class represents lazy list-like objects that collect the solutions provided by the solver and parsed by the PyMzn solution parser. The solution parser provides solutions to this object through a queue that is only accessed when this object is addressed or iterated over. If the queue has limited size (by using the max_queue_size option of the pymzn.aio.minizinc function), the execution of the solver will halt untill this object is addressed. Note that, by default, as soon as this object is addressed, the full queue is processed and it is cached in memory. To avoid this behavior, use the option keep_solutions=True in the pymzn.minizinc or pymzn.aio.minizinc functions.

Parameters
  • status (Status) – The status of the solution stream, i.e. whether it is complete, the problem was unsatisfiable or other errors that might have occurred.

  • log (str) – The log of the solver on standard output. Usually contains solver statistics and other log messages.

  • stderr (str) – The log of the MiniZinc executable on standard error. Usually contains log messages about the flattening process, statistics and error messages.

Methods

print([output_file, log])

Print the solution stream