adiar
adiar copied to clipboard
Simplify root logic in top-down algorithms
With #237 we made it possible to push to the root level of the levelized priority queue. This makes it possible to replace all of the root initialisation logic for most algorithms to be the much simpler request for the root from nowhere (i.e. where the source is NIL):
These algorithms already can deal with NIL parents:
- [x] adiar/internal/intercut.h
- [x] adiar/internal/prod2.h
- [x] adiar/internal/quantify
- [ ] adiar/internal/substitution
Algorithms that first need to support NIL valued parents:
- [ ] adiar/bdd/if_then_else.cpp (do this after/with #148 since that motivates adding an is_nil on the in-going arcs)
Algorithms that do not care about the parent of the request:
- [ ] adiar/internal/count.h
- [x] adiar/internal/pred.h
NOTE: Only the algorithms that do not support NIL parents cannot immediately be updated.
NOTE: This has low priority, since this (probably) will result in a performance slowdown compared to the current "loop-unrolling" for the root. On the other hand, it might improve performance by decreasing the size of the binary. The main argument for doing this is to decrease the likelihood for bugs.
UPDATE For v2.0 this is bumped up in priority (see comment below).
This becomes quite vital a change for reusing operations within the nested sweeping we want to do in version 2.0 ! Specifically, we need another layer of the __quantify
function after having set up the streams and the priority queue (with its initial request). This can then be used in two ways.
- As it is currently with a single request from NIL to the root.
- In the nested sweeping framework by prepopulating the priority queue with all the requests at level i.