learning FactorGraphModel

I know this is a huge PR again. Sorry about this. I added 2 classes: FactorGraphModel and FactorGraphFeatures. I tested PrimalMosek solver and BMRM solver, at least the simple example works. 

@ppletscher, @iglesias Please help me check the code. For the loss-augmentation, I am not sure it should be in MAPInference or in the model class, it's related to inference, but basically it modifies the energy table.