Merge pull request #1376 from hushell/fg_dev

MAP Inference for factor graph
max product inference for factor graph model