Optimal sampling techniques in off-line quality control