Message-Passing for Approximate MAP Inference with Latent Variables