Take the 2-minute tour ×

Occasionally FedEx or UPS may be unavailable to my app servers, or I need to process 100s of packages for a single transaction.

In these cases an estimate is better than nothing.

Currently I cache results for the exact parameters and "rounded" parameters, eg from_zip[:2], round(weight, 10)

What techniques should I look at to do better than this?

share|improve this question

2 Answers 2

I think that a better approach would be to use some kind or interpolation to perform a proximity search of the target price. It can be as simple as finding 2 bounding "points" and interpolating the price of the target point, probably also using a "distance" threshold to not generate too "wild" guesses.

Either way, it's very important to inform the users that the prices are estimates, and subject to change.

share|improve this answer
Thanks, I will add interpolation to the techniques I'm trying. I've also implemented a stochastic optimizer to find the best coefficients to various equations relating package weight and distance and falling back to nearby results when exceeding a certain distance. –  tln Jun 3 '12 at 16:05
You're welcome! –  Jordão Jun 3 '12 at 16:06

Rather than using distance, just use a zone lookup table. You should be able to download a zone chart for your account plus associated rates to create a simpler lookup.

share|improve this answer

Your Answer


