Efficient Inference Algorithms For Near-Deterministic Systems