The task of the delivery of goods

image

In this post, we will see how Flexport uses math and data science to solve delivery problems and deliver goods on time at the lowest possible cost.

Consider a speculative scenario: the forwarder has ten departures and one destination flight for any shipment. The only decision to be made is whether to assign each shipment to this single flight. If we do not assign a specific load to the flight, suppose it is possible to move it in another way.

Each shipment has volume and cost, and the flight is limited in volume. You may think of it as a simplified backpack problem. So, there are 1024-1 = 1023 possible solutions (we would not send the plane completely empty).

We could create a spreadsheet to list the entire solution and choose the most profitable one. But what if you have the same ten departures, but two flights? This is 59,049 solutions in just 10 shipments.

A large forwarder has more than ten departures and, of course, more than two flights to choose from, which leads to trillions to trillions of possible solutions. Among them, only millions are feasible, which means that the traditional spreadsheet method can find at least one feasible solution. But we do not need only feasible solutions. We need the best, optimal solutions. How to find them among countless possibilities? One answer is to use integer programming.

Integer programming is a subsection of discrete optimization, an area of ​​study of operations related to minimizing some objective function subject to constraints. We want to minimize the total costs, provided that the goods are delivered on time to the right places, stacked in ULD (Unit Load Device - a means of packaging goods). We strive for an optimal solution, but in practice sometimes we can’t achieve it. In this case, we are satisfied with a good or close solution. Here we restrict ourselves to a simple model in which the optimal solution is achievable.

The first step in solving this problem is to turn to the literature. The scientific community has been dealing with freight forwarding for many years. We found several works that are very reminiscent of our problem. We took many of the following concepts and notation from these works and thank the authors for their contribution to this area.

We start by defining the objective function. To minimize costs, we need to understand the concept of standard weight. In short, the standard weight is the minimum weight that the forwarder agrees to work with, regardless of what weight is actually offered. We have total weight, standard weight and odds for overloads and, conversely, underweight. The standard weight multiplied by the underweight is an underestimation, so we can ignore the underweight and focus on the overload coefficient multiplied by the overload itself.

The objective function is to minimize the total cost, defined as the total weight of all goods assigned by ULD, multiplied by the load factor. For example, if ULD1 has 100 kilograms of congestion and the congestion rate for ULD1 is $ 4 per kilogram, then the total cost of ULD 1 will be $ 400. So, we need some notation for being overweight and for its value.

Let beyjE β€Š- weight ULD j above standard and cjEβ€Š- cost factor for the same ULD. We need to calculateyjEcjE for all j. Ifj∈1,2,3then the objective function will be y1Ec1E+y2Ec2E+y3Ec3E. It collapses toβˆ‘yjEcjE. We want to minimize the value, so our final goal:

minβˆ‘jyjEcjE


Value for cjEnot a calculated value. This parameter is obtained from a spreadsheet or database. ButyjE we defined as total overload weight for ULD j, which we can calculate as the total weight of all supplies assigned by ULD (denote it yj), minus the standard weight of this ULD. Standard weight is specific to ULD type and is also a parameter. Let beUjP β€Šis the standard weight for ULD jin kilograms. Then the amount of extra weight for ULDj defined as yjE=yjβˆ’UjP.
The total weight of the ULD, of course, depends on what weights are assigned to the ULD and their weight. Therefore, we need an expression to calculate it, including the details mentioned above.

This is simply the sum of the weights assigned by ULD. How to indicate that a batch of goods has been assigned to a specific ULD? To do this, we need not a parameter, but a solution variable. A decision variable is something that the solver can control while minimizing the objective function.

Let the parametergi represents gross weight iin kilograms.
For instance,g4=500means that a load of 4 weighs 500 kilograms.

Let bexi,j β€Š- a decision variable taking the value 1, if shipment iassigned by ULD j, and 0otherwise. Thus, when we want to count all shipments assigned by ULD 3, we can loop through all the variablesxi,jwhere j=3. If we had 4 shipments, and shipment numbers 1 and 3 were assigned to ULD 3, it would look like this:

x1,3+x2,3+x3,3+x4,3=1+0+1+0=2

But we need total weight, not quantity. To obtain it, you can simply multiply each solution variable by a weight parameter. Since the decision variable takes the value 0, if it is not assigned a weight, then this weight is reset and not included in the total. Suppose the weights for cargoes one through four are 10, 50, 25, and 5. Then the total weight in ULD 3 will be:

g1x1,3+g2x2,3+g3x3,3+g4x4,3=(10)(1)+(50)(0)+(25)(1)+(5)(0)=10+25=35


Let's write this calculation of the total weight in general. Determine the total weight of the ULDj as yj. Theny1=g1x1,1+g2x2,1+…+gixi,1, and y2=g1x1,2+g2x2,2+…+gixi,2. We can collapse this using summation notationy1=βˆ‘gixi,1 and y2=βˆ‘gixi,2. Since we want this to be true for all possiblej, we use the "for all" sign: βˆ€. This gives us the final form of our total weight limit:

yj=βˆ‘i∈Igixi,jβˆ€j∈J



Extra weight


Now that we have the total weight, we can apply our formula for the extra load:

yjE=yjβˆ’UjPβˆ€j∈J



For example, if y1=1500and and U1P=1000then extra weight y1E=1500βˆ’1000=500kilograms. Multiply this by the cost factor to get the result in dollars. At first glance this may seem sufficient, but what about the case when the total weight of the entire cargo for ULD does not exceed the standard weight? In this case, if we used the β€œas is” formula, then the overload weight would be a negative number. For example, if the standard weight is 1650 kilograms and the total weight assigned is 1000 kilograms, then overload = 1000–1650 = -650. The objective function multiplies this number by a factor for overloads and we get a negative number. As if the carrier paid us for shipping less than the cost of a standard weight.

Here is what we really want:max(yjE,0).
This is the same as just setting 0 for a variable, which is as simple as creating a constraintyjE>=0.

yjE>=yjβˆ’UjPβˆ€j∈J, yjE>=0βˆ€j∈J

So, we implemented the function max () in mathematical programming: a = max (b, c), that is, a> = b && a> = c. Let's look at our definitions.
Objective function:minβˆ‘jyjEcjE
cjE: ULD Overload Ratio j
yjE: ULD overload j;

Source: https://habr.com/ru/post/undefined/


All Articles