MRG Thorsten opengm fixes

These are the fixes by @DerThorsten for vectorized creation of factor graphs.
Definitely speeds things up with the current version :)
No tests yet :-/
We should get some proper tests for OpenGM and also use dynprog as the default inference for chains...