How does the utility selector get the utility from a task far down the tree?


New member
This might be a stupid question that I should be able to figure out by looking at the code but I am still scratching my head a bit over how the utility selector can see the utility reported by a node far down in the tree. If we look at the utility theory sample (slightly modified), the utility selector sits at the top in the tree and the task that calculates the utility is down at the bottom.


When I look at the code for the utility selector it seems to check the utility value for its own child tasks, not the children of the children recursively down so somehow the utility value from the evaluate task is passed up through the tree, but how?


Staff member
The parent task GetUtility method will check all of the children. Because the Sequence and Parallel tasks are parents it will then check the utility value of the leaf children.