Choose nodes of a tree for the largest total, never a node with its parent: two values per node, take it or skip it, filled from the leaves up in one post-order walk. n calls against an exponential number for trying every allowed subset.
This interactive visualization needs JavaScript.