code: private double smartResidual(VarTensor message, VarTensor newMessage, int edge) {
          // This is intentionally NOT the semiring zero.
          return CachingBpSchedule.isConstantMsg(edge, fg) ? 0.0 : getResidual(message, newMessage);
      }
docs: Returns the "converged" residual for constant messages, and the actual residual otherwise.