Assume a set of behaviors <math>\Theta</math> and a goal named G. A behavior to pursue G is found as follows. Let <math>b</math> be the eventually-chosen behavior.
- (Match signatures.)
<math>S \subseteq \Theta</math> contains all the behaviors whose signatures are compatible with the arguments to G<ref>Signature matching is done with the same rules as in Java.</ref>.
- (Test preconditions.)
<math>P \subseteq S</math> contains all the elements of <math>S</math> whose preconditions are satisfied.
- (Test specificity.)
<math>B_f \subseteq P</math> contains all the elements of <math>P</math> which have the highest specificity. (There will be duplicates in <math>B_f</math> iff there are two behaviors in <math>P</math> with the same specifity.)
- (Choose behavior.)
Choose a <math>b \in B_f</math> randomly (uniformly).
Note that behavior selection is independent of whether the behaviors are