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

General expand function #34

Open
2 tasks
jaapdejong15 opened this issue Feb 24, 2023 · 4 comments
Open
2 tasks

General expand function #34

jaapdejong15 opened this issue Feb 24, 2023 · 4 comments
Assignees
Labels
Search.jl Everything to do with the Herb-AI/Search.jl repository

Comments

@jaapdejong15
Copy link
Member

jaapdejong15 commented Feb 24, 2023

Create an extendible expand function

  • Expand has an option for finding all holes
  • Expand uses an external function for picking the hole

Update: Explicit Hole objects can now be added to the RuleNode tree, eliminating the problem described in the conversation below.

@jaapdejong15 jaapdejong15 added the Search.jl Everything to do with the Herb-AI/Search.jl repository label Feb 24, 2023
@jaapdejong15
Copy link
Member Author

Currently, the search can only fill the first child of a node.
The children of a rulenode are a vector, and once a child is expanded, a new RuleNode is pushed to this vector.
Therefore, we can only expand a hole once all 'sibling' holes on the left are filled.

To make this general expand function work, we need to change how this works.
I think the best way to solve this is by introducing a special 'hole' RuleNode, e.g. a rulenode with ind=0 that we can use as a placeholder or by instantiating the children as a vector filled with 'nothing'.

@sebdumancic
Copy link
Member

I agree it is a good idea to explicitly introduce a 'hole' node. RuleNodewith ind=0 is a good convention for that.

Do you expect that the ability to fill in holes in different orders will impact some of the methods significantly? We anyways cannot evaluate an expression until all of its 'hole' children are filled.

@jaapdejong15
Copy link
Member Author

I don't think there will be a big impact on existing methods. Of course, the expand function has to be modified, and we do need to check existing functions for e.g. length(node.children). I know I have used this a couple of times to check whether all holes are filled, but I think this is mainly in the SpecificationExtraction repository.

It might also be a good idea to add a check to the rulenode2expr function for when you are trying to convert a partial tree to an expression. Right now you would probably get some index out of range exception.

@sebdumancic
Copy link
Member

Good idea! We should definitely make the holes more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Search.jl Everything to do with the Herb-AI/Search.jl repository
Projects
None yet
Development

No branches or pull requests

5 participants