pysat icon indicating copy to clipboard operation
pysat copied to clipboard

`ITotalizer` does not accept an `IDPool

Open Jaxan opened this issue 8 months ago • 2 comments

Hi all,

Previously I used the CardEnc class to encode size constraints. I need multiple constraints and so I used a single IDPool and passed it along all of the CardEnc instances. Then I wanted to make the size constraints incremental, and switched to ITotalizer. But this class does not take an IDPool, only a top_id.

Currently, my workaround is as follows:

vpool = IDPool()
...
with ITotalizer(lits, ubound=upper_bound, top_id=vpool.top) as cnf_optim:
  vpool.occupy(vpool.top + 1, cnf_optim.top_id)
  vpool.top = cnf_optim.top_id
  ...

Is this a correct workaround?

And would it be possible to add a vpool variable to the ITotalizer class, just like the CardEnc class? I find it much easier (and less error-prone) to use than passing around a top variable.

Thanks for the pysat package! It is really a wonderful interface to work with!

Jaxan avatar Jun 05 '24 08:06 Jaxan