initial MRF minimization version