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

Bug fix: Failure to remove nodes that introduce a loop in the tree. #10

Open
MogomotsiFM opened this issue Oct 22, 2024 · 0 comments
Open

Comments

@MogomotsiFM
Copy link

The code fails with the following exception: ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

This is because the test for equality is not defined for DataFrame objects. As a result, the nodes resulting in a loop are not removed and the tree is invalid.

The following is the test case that fails:

tree = Tree()
tree.condition(output=Action(value=100), condition="SubA")
tree.condition(output=Action(value=200), condition="SubB")
try:
    tree.include_subtree(tree)
except Exception as e:
    print(e)

To solve this, we note that the addresses of nodes are used to detect loops. As a result, we use these addresses to select nodes that must be removed. The proposed solution is at this branch: https://github.com/MogomotsiFM/dsp-decision-engine/tree/loop-causes

@MogomotsiFM MogomotsiFM changed the title Bug fix: Removing nodes that create a loop in the tree fails. Bug fix: Failure to remove nodes that create a loop in the tree. Oct 22, 2024
@MogomotsiFM MogomotsiFM changed the title Bug fix: Failure to remove nodes that create a loop in the tree. Bug fix: Failure to remove nodes that introduce a loop in the tree. Oct 28, 2024
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

1 participant