Closed brossignol closed 5 months ago
Thanks. I didn't update the pool when appending a new clause because this would surely affect the performance. The thing is there can be millions of clauses added by a user's encoder and in that case the user normally doesn't want to deal with the new Formula
functionality but rather to encode everything on their own. In this case, updating the pool is a waste of time.
This can be solved by adding a keyword argument update_vpool=False
.
@brossignol, I've now done this. Note that some of the tests started failing with this patch. (Some problem with _compute_nv()
).
Namely, the issue is that the function does not handle the case of an empty clause in the formula, which should be handled properly.
This is fixed now.
Hello, I propose a fix to
test_clausification
not passing after #167.Currently on master vpool are not cleaned correctly after creating a CNF:
It is because
Formula.cleanup
only looks at context within_instances
and not at context in._vpool
. It is possible to have a context in_vpool
without being in_instances
(ex: creating a CNF). It is also possible to have a context in_instances
without being in_vpool
(ex: creating Atom(int)). The bug didn't appear before because'default'
context was always in_instances
with Atom(True/False), but the problem still existed for other contexts.I propose to simply looks in both
_vpool
and_instances
when cleaning all.Additional fixes:
self.nv
what duplicated (with different variation doing the same thing), I propose to centralize it into_compute_nv()
.CNF.append
was not updating the _vpool occupy. I fix it. This will add some extra computation (not much) but I don't see a way around it.