probability-based energy function