I have a problem regarding "pruning" behavior in a tree. I have a multithreaded program…
- User
I have a problem regarding "pruning" behavior in a tree. I have a multithreaded program that searches through a tree. I'm working on a node 'domination' scheme with the two following cases. What's especially tricky is that order matters for this search. E.g. Order in the node's prefix matters, as in a search order of "1 2 3" and "3 2 1" are considered similar, but will have different prefix costs because of the ordering.
Ex: Given Node A and Node B, where Node A has a better prefix cost compared to Node B case 1: Node A is explored first, and its data is stored in a history table. Node B is visited later, checks the history table and sees a better node (Node A), and backtracks
case 2: Node B is explored first, and its data is stored in a history table. Node A is later visited, checks the history table, and sees that it has a better prefix cost than Node B. If Node B is still exploring, Node A will send a 'thread stop request' to Node B to backtrack to before it was dominated by Node A.
My question regards implementation for case 2. Currently, my approach is to have Node A set a flag in Node B that indicates that it should backtrack. The thread that's exploring the Node B's subtree should periodically check for this flag to know that it's been dominated and to backtrack. Problem is that this seems very inefficient, as there's no simple way for the nodes in the subtree of B to check that flag. My thinking was to propagate the set flat to all of Node B's children, but this seems like a poor solution.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.