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

How write a custom Heuristic, State dependent? #118

Open
Pietro-D opened this issue Jul 4, 2024 · 2 comments
Open

How write a custom Heuristic, State dependent? #118

Pietro-D opened this issue Jul 4, 2024 · 2 comments
Labels

Comments

@Pietro-D
Copy link

Pietro-D commented Jul 4, 2024

I am trying to implement A* search to solve a planning problem based on industrial manufacturing. Additionally, I want to write a custom heuristic, but I am facing issues getting information from the current state, such as true facts.

@pellierd
Copy link
Owner

pellierd commented Jul 4, 2024

From the your planing problem you can obtain its initial state. Then, you can build a state using the class State. This class inherits from Bitset. It is then sufficient to iterate over the positive bits. To obtain the true fluent, simply retrieve the element from the problem's fluents array that is at the index of the true bit in the vector.

To implement a new heuristic in your case a suggest to inherit from StateHeuristic.

@Pietro-D
Copy link
Author

Pietro-D commented Jul 4, 2024

@pellierd thanks for the answer. How can I associate bits in BitSector with true facts in the current state? I want to create a Map<String, Integer> where the key is the name of a true fact in the current state, and the value is its index in the BitSet. My goal is to identify only certain predicates that are true in the current state.

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

No branches or pull requests

2 participants