Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtree(root) returns a circuit node instead of vtree node in some cases #83

Closed
khosravipasha opened this issue Mar 25, 2021 · 3 comments
Closed

Comments

@khosravipasha
Copy link
Collaborator

khosravipasha commented Mar 25, 2021

I think it is due to some type issues:
minimal example:

using LogicCircuits
random_lc = zoo_sdd("random.sdd");
vtree = zoo_vtree("random.vtree");

plc = propagate_constants(random_lc , remove_unary=true);
structplc = compile(StructLogicCircuit, vtree , plc);
sstructplc = smooth(structplc);

vtree(sstructplc)

It returns a PlainStruct⋁Node instead of a PlainVtree. If I do sstructplc.vtree returns the correct value though.

The code seems to be from here, maybe a different code is getting called.
https://github.com/Juice-jl/LogicCircuits.jl/blob/65038f92373d07c58716cfec0d998487a2b8f040/src/structured/structured_logic_nodes.jl#L103

@khosravipasha khosravipasha added the bug Something isn't working label Mar 25, 2021
@talf301
Copy link
Member

talf301 commented Mar 25, 2021

I just tinkered with this in console for a bit, I think you're just overwriting the "vtree" name. When I named it vtr instead the vtree() call at the end returns a vtree (I'm not sure what causes that overwrite to have last statement get a circuit type...)

@khosravipasha
Copy link
Collaborator Author

oops, yeah, I think you are correct haha. I was expecting the function vtree gets called. I think this is common enough (people naming their vtree as vtree) that we should somehow prevent this mistake.

@khosravipasha khosravipasha removed the bug Something isn't working label Mar 25, 2021
@guyvdbroeck
Copy link
Member

I removed to ability to use a vtree object as a function to construct circuit nodes in 00177e3
The code should now throw an error rather than silently giving a circuit node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants