add helper functions to StructuredOutputMachine

@uricamic @iglesias @sonney2k: I made tiny changes on the bundle methods for convex optimization (ncbm is not included here). There are 2 reasons for doing this: 1) without normalizing risk, the primal objectives are too large for the dual objectives, sometimes it's unrealistic to expect a zero duality gap in reasonable training time; 2) it is not convenient to compare with other solvers like SGD, which uses normalized loss/risk. However, I am not 100% sure what I changed are correct. Could you check the changes and think about potential issues?