# Sensible and realistic way to model truck based transport costs depending on amount

Different kinds of problems involve transporting an amount $$x$$ from A to B which results in a cost $$c(x)$$ in the objective function.

Traditionally, often linearized costs are used to get an easy, linear model. This might lead to unrealistic solutions if transport volumes are small.

What are more realistic ways to model transport costs (considering especially road transport, to be more specific) which nevertheless lead to manageable and practically solvable mixed integer programs?

• Might be interesting to include an example problem in which you would like to come with a better approximation of transport costs? Jun 12, 2019 at 14:34
• So, your question is not about how to use a more realistic cost c(x) function (because this is just a replacement of a simple function with a more complicated one in your code) and rather, what are some examples of more realistic cost functions, correct?
– EhsanK
Jun 12, 2019 at 14:38
• Examples of cost functions that include the main features of real world costs without being intractable by MIP solvers. I came to this by looking a hub location problems, but any problems that include amount dependant transportation costs (that cannot be preprocessed) is also interesting. (BTW: I managed to write question number 100. Yeah!). Jun 12, 2019 at 14:46
• Congrats, #100! :) Jun 12, 2019 at 15:06
• Can you be more specific about what features of real world costs you have in mind? Nonconvexities? Step functions? Usually things like that are modeled using piecewise linear functions; is that the kind of thing you’re asking for? Jun 12, 2019 at 15:09

In my experience, there are two types of logistics modeling questions that require truck transportation costs.

In the first, a shipper will operate a fleet of its own vehicles and would like to estimate costs. In such cases, it is usually important to model both fixed costs of using additional vehicles and the variable costs of operating vehicles (which vary with distance travelled and/or time operated). Any cost approximation should be careful to appropriately model these fixed costs.

In the second type of problem, a shipper will outsource truck transportation to meet its shipping needs. Here is a bit more detail about that scenario:

Purchased truck transportation:

In this case, a shipper needs to purchase freight transportation from third parties (like trucking companies (carriers) or from third-party logistics (3PL) firms). Different types of truck service are available for purchase, most notably truckload, less-than-truckload, or small package services. Each type of service is priced somewhat differently. It is quite common that truckload services on a lane $$(i,j)$$ are priced per trailerload, and thus a step function for cost is often needed. LTL and package services on a lane are typically priced per weight (or per some weight-and-cubic-volume measure like dimensional weight), and there are often rate breaks where the price per weight decreases at larger weights making piecewise-linear cost functions necessary. Often these functions do not have strictly-decreasing slopes since they may include shoulders where cost is fixed for a certain weight range.

One common $$c(x)$$ function is a "cost per distance unit (mile/km)" like $2/mile, which is just distance-dependent. My 2 cents for more realistic cost functions: For distance-dependent costs: • Use a different distance function. If you are using linear distance (Euclidean or Manhattan), replace it with a better approximation like Haversine distance or the real distance obtained from, for example, Google map API. • Of course, better depending on your use case. In Manhattan, Manhattan distance is good! • Generally, there should be a minimum amount on the route cost. Assuming the simple \$2/mile charge, you won't charge just \\$20 if you drive for 10 miles. So, $$\text{Cost}=\max(\min{\rm charge}, c(x))$$

For amount-dependent costs:

Use some piecewise approximation so that you can pre-process the cost. For example, if you have cost of $$c(q)$$ (where $$q$$ is a decision variable for the quantity on arc $$(i,j)$$, your cost function in your code, should be conditional on the value of $$q$$.

Note, although I used the word "approximation", this is more or less how it works in real-world instances. Your cost does not depend on every increment of $$q$$, rather it goes up and down depending on the range or bin where $$q$$ falls in.