Persistency algorithms for efficient inference in Markov Random Fields