# Need Help Creating an Unbiased Rating System

The problem, in general terms:

At work, we're supposed to come up with an algorithm to split the expenses incurred during shipping when more than one order is being shipped on the same truck. Basically, we pay the trucking company a flat fee, and charge each customer a different amount for each order. We charge customers based on the footage they take up, and the distance they travel (in miles).

Say, for instance, we have four orders:

 Order #    Start     End              Miles     Footage    Revenue
========   =======    =============   =====     =======    =======
1          Chicago -> Indianapolis      250       10       $200 2 Chicago -> Cleveland 400 20$500
3          Chicago -> West Virginia     600       10       $400 4 Chicago -> New York 850 10$600

Total Revenue:             $1700 Payment Due to Driver:$1400
Consolidated Order Profit: $300 Order 1 Profit: ? Order 2 Profit: ? Order n...  These are example ratings. Well, my theory was this: 1. Take the rate per mile 2. Take the rate per foot 3. Average the two  However, that seems braindead. Am I getting the true profit for each order this way? For instance: Anna, Brad, and Cathy are sharing a truck on three orders. Anna's load is going 100 miles, and takes up 10 feet. Brad's load is going 200 miles, and takes up 20 feet. Cathy's load is going 300 miles, and takes up 20 feet.  Now...Do I take the total footage (50 ft.), and blindly smear that ratio of footage to determine the company's cost to ship that load for that order? Or...do I take each stop, understand that after 101 miles, Anna's 10 feet are no longer on the truck, and will raise the observed rate to ship the other two orders? This, in the long run, will protect salespeople like Cathy, who should be given a greater ratio (the last 100 miles, Cathy's load takes up 100% of the truck's load), and therefore, a higher commission. Thanks everyone! - First, you need to determine your objectives. It is clear that you don't want to loose money, but it is not clear if you want to make money off the customer or you only want to cover your expenses. Also, if you pay flat fee, then there are chances where you may have few shipments where you won't cover your cost. So, may be you want to take that in consideration as well. – Emmad Kareem Dec 16 '11 at 20:50 The objective is to determine the profit per order. Salespeople make commission off this, and if they can (and they will) increase the company's profits by truck sharing their orders, they'll make more money come payday. The question is...how much? – Droogans Dec 16 '11 at 20:55 I guess that we can't calculate the profit reasonably without knowing how we calculate the shipping costs first (the flat rate you mentioned - In the example above called Payment Due to Driver). For example, is the flat rate is based only on distance, then footage does not really mater. – Emmad Kareem Dec 16 '11 at 21:16 How do we know what to pay the driver? Honestly, that's a five year project :D...it's a lot of knowledge, experience, and feel. What's the commodity? Does it spoil? Is it in season? Is it in high demand? Are you shipping someplace where you can ship freight back from? Too many variables to list here...so, I left the basics open to build a model, and implement it in the system. I'll elaborate my question. – Droogans Dec 16 '11 at 21:22 ## 2 Answers One alternative is the taxicab approach. Express the cost of the truck as dollars per mile. For each mile that a shipment is aboard, it bears its share of the cost, rated by feet. So if your truck costs \$1/mile and starts with Anna's 10 foot load and Brad's 30 foot load, Anna pays \$0.25/mile for that segment and Brad 0.75/mile. Then you unload Anna and Brad pays the full \$1/mile. Then you load Cathy's 20 foot load and Brad pays \$0.60/mile while Cathy pays \$0.40/mile. It's not fair in that you want to be loaded last and delivered first.

-
Another way to describe this same solution is that you bill your customers at a fixed rate with dimensions $\mathit{distance}·\mathit{volume}/\mathit{money}$. –  Kevin Reid Dec 18 '11 at 22:58
@KevinReid: that is another approach, but in my solution what one customer pays depends upon what other freight is on the truck at the same time. You could certainly try to figure out what average rate that you propose would come out the same total revenue, then each customer would know what they would pay. Or (like some companies do) bill each customer for the whole truck and keep the profit. –  Ross Millikan Dec 18 '11 at 23:55
Oops, you're right. –  Kevin Reid Dec 19 '11 at 0:38
@RossMillikan Haha, I upvote you sir. Very funny, very true. A good software engineer will keep them honest! –  Droogans Dec 19 '11 at 2:14

You need to use game theory and in particular the Shapley value to split the cost. The customers are in some sense cooperating to have their products delivered to them efficiently by sharing a truck that you pay for, and the Shapley value gives a way to "fairly" split the cost. Of course this is an academic answer that has no relevance to the real world so you will not use it.

-
I see what you're saying about the game theory approach. I need to find a practical way to measure the amount of available space on the truck at any given mile, and measure the "value per foot" on the truck, given it's location on the route (read: calculus). But thanks anyway for your suggestion! We have no way to determine what they individual customer could expect to gain or lose without cooperation, so yes, it's not very useful. –  Droogans Dec 16 '11 at 20:37