basic implementation of branch and bound search