The Algorithm
For each stage i from 1 to m do
For each unchosen subgoal S pick the most general & feasible BP B of S
w.r.t. V & FBP such that B is not in HTBP.
Push SB into C[i]. Mark S chosen.
Add all variables of S to V
If no such B exists, but there is a feasible binding pattern for S
Pick the BP B’ with most bound variables (in terms of #(.))
If no subgoal has been chosen at this level (C[i] is empty),
and there are some postponed sources (P[i] is non-empty)
Choose SkB in P[i] with the maximum #(B) value
Add all variables of Sk to V
Default case: Reduce accesses
HTBP case: Reduce transfer costs