Tractables / LogicCircuits.jl

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

Optionally pass an IO instead of filename to vtree saving #62

Closed RenatoGeh closed 3 years ago

RenatoGeh commented 3 years ago

Hi,

I'm working on ensemble of PSDDs, and to make life easier I decided to save ensembles as zip files with .psdd and .vtree files in them. The current versions of LogicCircuits and ProbabilisticCircuits don't let you pass an IO, making you use the filename instead. The way ZipFile (https://github.com/fhs/ZipFile.jl/blob/master/src/ZipFile.jl) is implemented, I'd need to pass an IO instead. This PR gives saving/loading more flexibility by allowing you to alternatively pass an IO. I added a few tests just to make sure I didn't break anything and they're all green. :)

Thanks, Renato

codecov[bot] commented 3 years ago

Codecov Report

Merging #62 (5e12911) into master (0ae3412) will decrease coverage by 2.12%. The diff coverage is 96.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #62      +/-   ##
==========================================
- Coverage   84.04%   81.92%   -2.13%     
==========================================
  Files          29       29              
  Lines        2369     2373       +4     
==========================================
- Hits         1991     1944      -47     
- Misses        378      429      +51     
Impacted Files Coverage Δ
src/LoadSave/circuit_savers.jl 98.19% <80.00%> (-0.45%) :arrow_down:
src/LoadSave/vtree_loaders.jl 100.00% <100.00%> (ø)
src/LoadSave/vtree_savers.jl 90.90% <100.00%> (+0.34%) :arrow_up:
src/Utils/cubitvector.jl 28.57% <0.00%> (-18.10%) :arrow_down:
src/Utils/data.jl 65.66% <0.00%> (-14.46%) :arrow_down:
src/satisfies_flow.jl 32.52% <0.00%> (-7.62%) :arrow_down:
src/bit_circuit.jl 78.84% <0.00%> (-1.93%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0ae3412...5e12911. Read the comment docs.

khosravipasha commented 3 years ago

Thanks for the PR. The changes and tests look good so I am merging it. The codecoverage going down does not seem to be because of these changes. The last codecoverage report was run on gpu machine so the change of coverage is due to that.