add Forward-Backward inference algorithm.