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

Simu

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.

1609923411264.png

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?
 

Justin

Administrator
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.
 
Top