Accurate tariff coding for cost optimization