Compute-and-forward is a framework for reliable physical layer network coding introduced by Nazer and Gastpar. Instead of decoding single messages, it decodes linear combinations of messages with the help of nested lattice codes. Nazer and Gastpar derived an achievable rate for each node depending on the channel coefficients and the desired equation coefficients. However, it is open how to choose the coefficient vector with the equation coefficients. We provide a branch-and-bound algorithm that calculates the coefficient vector, which results in the highest computation rate at a single node. We implemented the algorithm in Matlab and compared the number of iterations to the number of needed iterations if we use a complete search over all possible vectors.Index Terms-compute-and-forward, network coding, branch-and-bound algorithm