add forward_backward algorithm