Tractables / LogicCircuits.jl

Logic Circuits from the Juice library
https://tractables.github.io/LogicCircuits.jl/dev/
Apache License 2.0
49 stars 4 forks source link

Potential Issues with traversal infra, counters #64

Closed khosravipasha closed 3 years ago

khosravipasha commented 3 years ago
  1. foreach_down had some unexpected behaviour
  2. reset_counter might not work in all cases

And overall want a more reliable way of reseting the travesals without having to reload the circuit again.

guyvdbroeck commented 3 years ago

I added reset_counter_hard in https://github.com/Juice-jl/LogicCircuits.jl/commit/fbdedf2157e58fd606155cac5b7aa8746a920f71 It resets the counter even if the nodes' fields are messed up (but is slower than the default implementation).

julia> circuit = load_smooth_logic_circuit(zoo_psdd_file("plants.psdd"));

julia> @btime (reset_counter(circuit,1);reset_counter(circuit,0))
  46.723 ms (0 allocations: 0 bytes)

julia> @btime (reset_counter_hard(circuit,1);reset_counter_hard(circuit,0))
  73.743 ms (540960 allocations: 14.26 MiB)

I believe this closes the issue?