Discrete minimization of the Bethe free energy.