<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Andrew Sturges on Medium]]></title>
        <description><![CDATA[Stories by Andrew Sturges on Medium]]></description>
        <link>https://medium.com/@asturges?source=rss-8db533494fcd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*4f5H4B_lp8qlc1_5Z-paMg.jpeg</url>
            <title>Stories by Andrew Sturges on Medium</title>
            <link>https://medium.com/@asturges?source=rss-8db533494fcd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:50:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@asturges/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Mixed Integer Programming to Assign Air Cargo to Flights]]></title>
            <link>https://medium.com/flexport-engineering/using-mixed-integer-programming-to-assign-air-cargo-to-flights-42437bae9945?source=rss-8db533494fcd------2</link>
            <guid isPermaLink="false">https://medium.com/p/42437bae9945</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[flexport]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Andrew Sturges]]></dc:creator>
            <pubDate>Thu, 23 Jan 2020 19:29:43 GMT</pubDate>
            <atom:updated>2020-01-27T17:26:35.139Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pnlkcp6YmYdKaPP2eh_d-g.jpeg" /><figcaption>Loading a KLM converted 747 freighter.</figcaption></figure><p>In <a href="https://flexport.engineering/air-cargo-supply-and-demand-at-flexport-b7c0f980e2cc">a previous post</a> we outlined the basics of supply and demand in the world of air freight forwarding, and described the difficult problem of air cargo consolidation. In this post we’ll look at how Flexport uses math and data science to solve this problem and get shipments delivered on time at their lowest possible cost.</p><p>Consider a toy scenario where a freight forwarder has ten shipments, a single flight to assign any shipment to, and the only decision to make is whether to assign each shipment to the flight. (In this toy scenario, if we choose not to assign a particular shipment to the flight, assume we can move it some other way.) Each shipment has a volume and a cost, and the flight has a total available volume that cannot be exceeded. (You may recognize this as a simplified <a href="https://en.wikipedia.org/wiki/Knapsack_problem">knapsack problem</a>.) In this case there are 2¹⁰=1,024 possible solutions (actually 1,023 since we wouldn’t send the plane completely empty).</p><p>Maybe you could create a spreadsheet to list out each possible solution and choose the one with the lowest cost. But what if you had the same ten shipments but two flights to choose from? Now you have 3¹⁰=59,049 solutions to calculate. For just ten shipments!</p><p>A large freight forwarder will have many more than ten shipments and many more than two flights to choose from, leading to trillions upon trillions of possible solutions. Among these, perhaps mere millions are <em>feasible</em>, and maybe the traditional spreadsheet method can find at least one feasible solution. But at Flexport we don’t want just the feasible solutions. We want the best solutions, the <em>optimal</em> solutions. How do we find an optimal solution among the countless possibilities? One answer is to use integer programming.</p><p>Integer programming is a subfield of discrete optimization, a field of operations research concerned with minimizing some objective function subject to constraints. In our case, we want to minimize total cost subject to getting shipments to the correct destinations on time and not over-filling ULDs. (If you don’t know what a ULD is, go back and read <a href="https://flexport.engineering/air-cargo-supply-and-demand-at-flexport-b7c0f980e2cc">part 1</a>.) In practice, though we desire the optimal solution, we are sometimes unable to get to optimality, and in this case we are happy with a good or close solution. In the post we’ll limit ourselves to a simple model in which we can achieve optimality.</p><p>The first step when tackling a problem like this is to consult the literature. The academic community has addressed the freight forwarding domain for years, and we <a href="https://doi.org/10.1016/j.cor.2014.11.015">found</a> <a href="https://doi.org/10.1016/j.trc.2011.08.001">several</a> <a href="https://doi.org/10.1016/j.trc.2015.03.028">papers</a> that closely resembled our problem. We took many of the following concepts and notation from these papers, and we thank the authors for their contributions to the field.</p><h3>Objective Function</h3><p>Let’s start by defining an objective function, which will motivate our notation and constraints. We want to minimize cost, and to minimize cost we need to understand the concept of pivot weight, which we explained in detail in <a href="https://flexport.engineering/air-cargo-supply-and-demand-at-flexport-b7c0f980e2cc">part 1</a>. Briefly, pivot weight is the minimum weight that a freight forwarder commits to paying for, regardless of how much weight the forwarder actually tenders. We have a total weight, a pivot weight, an under-pivot rate, and an over-pivot rate. The pivot weight multiplied by the under-pivot rate is a sunk cost, so we can ignore it, and focus only on the over-pivot weight multiplied by the over-pivot rate.</p><p>The objective function is to minimize the total cost, which we define as the total over-pivot weight of all shipments assigned to a ULD, multiplied by the over-pivot rate. For example, if ULD 1 is 100 kilograms over pivot, and the over-pivot rate for ULD 1 is $4/kilogram, then the total cost for ULD 1 is $400.</p><p>So to begin, we need some notation for over-pivot weight and for over-pivot cost.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/101b6819fca6af8b5a810fd75bdbd8c2/href">https://medium.com/media/101b6819fca6af8b5a810fd75bdbd8c2/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/042aedba5d5ec32311bab634ea54a412/href">https://medium.com/media/042aedba5d5ec32311bab634ea54a412/href</a></iframe><p>The total weight of a ULD of course depends on which shipments are assigned to the ULD, and their individual weights. So we need an expression to calculate it that includes these terms.</p><h3>Total weight</h3><p>The total weight of a ULD is simply the sum of the weights of the shipments assigned to the ULD. How do we indicate that a particlar shipment has been assigned to a specific ULD? For this we need not a parameter, but a decision variable. A decision variable is something that the solver can control and adjust in its effort to minimize the objective function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c216e363e73fa4256a13fe7aa39ffba0/href">https://medium.com/media/c216e363e73fa4256a13fe7aa39ffba0/href</a></iframe><p>But we’re after the total weight, not the count. To get the weight, we can just multiply each decision variable by the weight parameter, and because the decision variable takes the value 0 if it’s not assigned, then the weight will be zeroed out and not included in the total weight. Let’s say the weights for shipments 1 through 4 are 10, 50, 25, and 5. Then the total weight assigned to ULD 3 would be as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/067f3672a24079511cd66d265e9e7e19/href">https://medium.com/media/067f3672a24079511cd66d265e9e7e19/href</a></iframe><p>In words one would say “yj is the sum over all i of gi xi,j for all j in J.”</p><h3>Extra-pivot weight</h3><p>Now that we have total weight, we can apply our formula for extra-pivot weight:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/010522d34d8ea504c738455a390b9987/href">https://medium.com/media/010522d34d8ea504c738455a390b9987/href</a></iframe><p>We’d multiply this by the over-pivot rate to get our total charge, in dollars. At first glance this might seem sufficient, but what about the case when the total weight of all the shipment assigned to the ULD doesn’t actually exceed the pivot weight? In that case, extra-pivot weight would be a negative number if we used the formula as is. For example, if pivot weight is 1650 kilograms, and total assigned weight is 1000 kilograms, then extra-pivot weight = 1000–1650 = -650. The objective function would then multiply this by the over-pivot rate, and we’d get a negative dollar amount back, as is if the carrier would pay us for shipping less than the pivot weight.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e69b1aa68026aa4f4a69adbe038db48/href">https://medium.com/media/4e69b1aa68026aa4f4a69adbe038db48/href</a></iframe><p>What we’ve effectively done is to implement the max() function in mathematical programming. a=max(b, c) is simply a&gt;=b and a&gt;=c.</p><p>Let’s review what we’ve defined so far:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b953b239ea6c131134be5cfbc83eb0cb/href">https://medium.com/media/b953b239ea6c131134be5cfbc83eb0cb/href</a></iframe><h3>Every shipment must fly</h3><p>At this point, we could code this up in Python (using <a href="https://pyomo.readthedocs.io/">Pyomo</a>, for example) and send it to a solver. If we did, we’d find the solver would assign zero shipments to any flight, and we can quickly see why: The best way to minimize the objective function is to accrue no costs. This leads us to our next constraint: Every shipment must be assigned to a ULD. (For our purposes we’ll extend this to each shipment must be assigned to one and only one ULD, though in reality Flexport can split a shipment across several ULDs and even across several flights.)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68b223ff84b1c79042b51e2d9a1bd855/href">https://medium.com/media/68b223ff84b1c79042b51e2d9a1bd855/href</a></iframe><p>With this constraint in place the solver would actually start assigning shipments to flights, but it would simply spread out shipments among all available ULD until the pivot weights were met. Then it would put every remaining shipment into the single ULD with the lowest extra-pivot cost without regard for that ULD’s volume or weight capacities. So the next two constraints we’ll add are volume and weight.</p><h3>Volume and weight constraints</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59b5162140effa0c0a901ad63390669a/href">https://medium.com/media/59b5162140effa0c0a901ad63390669a/href</a></iframe><p>A freight forwarding industry veteran will immediately recognize that this constraint does not actually represent reality. Why? Because it treats the cargo as if it can be poured like water into any volume. In reality, cargo is rigid, some of it comes in large cartons, some of it comes in large pallets, some of it is unstackable. 10 cubic meters of such cargo cannot be packed into an arbitrary volume of exactly 10 cubic meters. The way to handle these cases is to run another type of optimization called bin packing to check whether certain volumes will fit inside another volume, but that is beyond the scope of this post.</p><p>With those two additional constraints in place, now the solver will assign shipments to ULD respecting max weight and volume while minimizing total cost. But there’s still one problem: We haven’t said anything about assigning to shipments to ULDs that are going to the right destination, or meeting delivery deadlines. Let’s tackle those next.</p><h3>Origin and destination</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d8e103c8747315a2b358d168f7fb1fb/href">https://medium.com/media/0d8e103c8747315a2b358d168f7fb1fb/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnDQYYSb4LJ8yq_WvfUjzA.jpeg" /><figcaption>Tail-facing view of the interior of an empty air freighter.</figcaption></figure><h3>Delivery timeline</h3><p>When dealing with timestamps in optimization, it’s convenient to represent datetime as Unix time, which is the number of seconds elapsed since Jan 1 1970 (the Unix epoch). This allows us to pass timestamps to the solver as floats, and lets the solver do direct comparison using mathematical operators like greater-than and less-than. It also saves us from having to handle timezones.</p><p>There are actually four timestamps that need to be accounted for when assigning a shipment to a ULD:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/01c66576bdc72d5b81e7fb6655828f71/href">https://medium.com/media/01c66576bdc72d5b81e7fb6655828f71/href</a></iframe><p>Given these parameters, we need two constraints: 1) That the shipment ready time be before the cargo cutoff time, and 2) that the flight arrival time be before the shipment delivery deadline. These should apply only for flights that are on the correct origin-destination lane. We can program those constraints as follows.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b11bfb032af902b71d7d876ab5164f36/href">https://medium.com/media/b11bfb032af902b71d7d876ab5164f36/href</a></iframe><p>That’s it! Let’s review the full model.</p><h3>The full model</h3><p>With those constraints in place, the solver will assign shipments to ULDs in a globally least-cost way, while getting every shipment from the correct origin to the correct destination, after the shipment is ready, on time, and without overloading any ULDs by volume or weight.</p><h3>Parameters</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccc1472a5c58fd59ba3e4b9353ca2391/href">https://medium.com/media/ccc1472a5c58fd59ba3e4b9353ca2391/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6cfcd5e2bd34a304ff8687fec3058af6/href">https://medium.com/media/6cfcd5e2bd34a304ff8687fec3058af6/href</a></iframe><h3>Decision variables and objective function</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/efba95fc4acc81eaec07e88ffa2ee6f5/href">https://medium.com/media/efba95fc4acc81eaec07e88ffa2ee6f5/href</a></iframe><h3>Constraints</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/32b5116f4dfb7db302b5e0c091f17246/href">https://medium.com/media/32b5116f4dfb7db302b5e0c091f17246/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a7353e6db6f255c0453b601c7af8dbf6/href">https://medium.com/media/a7353e6db6f255c0453b601c7af8dbf6/href</a></iframe><h3>Next steps</h3><p>This post has described the mathematical programming behind shipment-to-flight assignment. But just writing down the math isn’t enough. The next step is to implement the program, likely in an AML like Pyomo, or using a solver’s native API (such as Gurobi’s Python API). After that, the developer would write code to pass in the parameters for all the available shipments and flights. Then the instantiated model would have to be sent to a solver. The solver would set the values of the decision variables in an optimal way. It’s then up to the developer to do something with the values of those decision variables.</p><h3>Conclusion</h3><p>In traditional freight forwarding, shipment-to-flight assignment is done by hand, with the help of spreadsheets. It’s possible to satisfy all the basic constraints using a spreadsheet, and find at least one feasible solution. But doing it this way virtually precludes finding an optimal solution, which is a consolidation that satisfies all constraints at the least possible cost across all shipments. An optimal solution means the freight forwarder can move more shipments on fewer flights. This means more shipments arrive faster, at a lower cost, and with a smaller carbon footprint.</p><p>At Flexport, we are applying operations research like this to the fields of air cargo, warehousing, trucking, ocean shipping, marketplace optimization, and more. Are you interested in routing engines, linear programming, graph theory, and geospatial analysis? Do you want to work in an industry with a concrete real-world impact, helping global trade flow without friction? Did you know we’re on LinkedIn’s list of <a href="https://www.linkedin.com/pulse/linkedin-top-startups-2019-50-hottest-us-companies-work-jessi-hempel/">50 hottest U.S. companies to work for</a>? Did you know we are hiring? Check out our <a href="https://www.flexport.com/careers">careers page</a> to see all our openings in operations research, data science, data engineering, analytics, and software engineering. We’re hiring for all levels at our headquarters in San Francisco, as well as select engineering roles in Chicago, Shenzhen, and Amsterdam.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42437bae9945" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flexport-engineering/using-mixed-integer-programming-to-assign-air-cargo-to-flights-42437bae9945">Using Mixed Integer Programming to Assign Air Cargo to Flights</a> was originally published in <a href="https://medium.com/flexport-engineering">Flexport Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Air cargo supply and demand at Flexport]]></title>
            <link>https://medium.com/flexport-engineering/air-cargo-supply-and-demand-at-flexport-b7c0f980e2cc?source=rss-8db533494fcd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7c0f980e2cc</guid>
            <category><![CDATA[logistics]]></category>
            <category><![CDATA[air-cargo]]></category>
            <category><![CDATA[freight-forwarding]]></category>
            <dc:creator><![CDATA[Andrew Sturges]]></dc:creator>
            <pubDate>Sat, 14 Sep 2019 00:08:18 GMT</pubDate>
            <atom:updated>2020-02-25T17:02:21.658Z</atom:updated>
            <content:encoded><![CDATA[<p>At Flexport, the Air Team manages all facets of moving air cargo from origin to destination. We do so by matching up demand (cargo) with supply (flights). Supply is somewhat fungible — the cargo doesn’t care if it’s on one aircraft or another, as long as both are capable of moving it from point A to point B. There’s nothing Flexport can do to make an aircraft fly faster (though we do speed up ground handling by using our own warehouses), but the Air Team can make shipping on these aircraft cheaper by optimizing our consolidation, the set of shipments on each flight.</p><p>To understand consolidation, we first need to understand the basics of supply and demand in air cargo, and how Flexport moves shipments through the skies. In this post we’ll discuss supply and demand, and in the next one, we’ll explain how Flexport uses math¹ to achieve perfect optimization, getting more air shipments to their destinations at the least possible cost.</p><h3>Unit Load Devices</h3><p>First, we need to talk about how air cargo physically moves. In the same way that ocean freight is containerized before being loaded onto a ship, air cargo is built up into standard “contours” called <a href="https://www.flexport.com/help/621-unit-load-device">Unit Load Devices</a> (<a href="https://en.wikipedia.org/wiki/Unit_load_device">ULD</a>s). ULDs are identified by three-letter codes like AKE, AKH, and PMC. Some are containers, and some are just metal pallets. Each one has a specific shape that is designed to fit into a particular part of a particular aircraft. This is akin to each ULD having a “parking space” on the aircraft. Each aircraft has a very specific layout of parking spaces, and each parking space can accommodate one or more types of ULDs.</p><p>For example, the Boeing 777 is the most common passenger aircraft flying between Hong Kong International Airport and Los Angeles International Airport.² Hundreds of passengers sit on the main deck (the upper deck), but the lower deck has ten parking spaces available for P6P ULDs, each of which measures 125 by 96 by 64 inches.3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzhoHo_zfqpVyGlF8zxw9Q.jpeg" /><figcaption>Lower deck ULD being loaded onto a passenger flight</figcaption></figure><p>If the 777 were a dedicated freighter instead of a passenger aircraft, then the entire main deck, instead of being filled with seats, overhead bins, and restrooms, would be an empty volume available for ULDs. The main deck is taller and has a wider floor, so it can accommodate a greater variety of ULDs.</p><h3>PMCs and Consolidation</h3><p>The most common ULD is the PMC, shown in the above photos. A PMC is not a metal container, but a standardized metal pallet measuring 96 inches by 125 inches, on top of which cartons are stacked. But you can’t stack cartons in just any shape. There are very specific contours inside of which the cartons must remain. Since these are just pallets and not containers, you have to be careful that the cartons you stack don’t exceed the imaginary lines of the specific contour you’re building. Some PMCs define basic rectangles, and some define additional bevels and more complex angles that allow them to tuck into the curved side of an aircraft. These contours have their own codes, such as H2, Q5, and Q7. Once the cartons are assembled into the right contour, the whole pallet is covered with plastic and cargo nets. Finally, the ULD can be forklifted onto a truck to be delivered to the airline’s cargo terminal, where the ground crew will take over and load it onto the aircraft.</p><figure><img alt="Interior of an air freighter showing main deck and unit load devices (ULDs)" src="https://cdn-images-1.medium.com/max/1024/1*HYCbIHUbab6c8XK8eU8Pog.jpeg" /><figcaption>Interior of an air freighter showing main deck and unit load devices (ULDs)</figcaption></figure><h3>Air Cargo Supply</h3><p>Supply refers to any capacity available to a freight forwarder to move air cargo. Capacity is provided by airlines, which we call carriers. Carriers sell capacity to freight forwarders, and freight forwarders try to fill that capacity with cargo. The capacity may be on passenger flights or on dedicated freighters. Flexport procures capacity via three main avenues: 1) Long-term contracts called allocations, 2) the spot market and 3) partner agreements.</p><h3>Allocations</h3><p>Allocations comprise the largest component of supply for a large freight forwarder. An allocation defines a “committed weight” between one or more airports, and it’s the freight forwarder’s responsibility to achieve this committed weight by tendering cargo. For example, Flexport might have an allotment with Happy Airlines that specifies Flexport commits at least 100 metric tons of cargo every month on any Happy Airlines flights originating in Hong Kong and arriving anywhere in the United States (the HKG — US trade lane). It’s most common to achieve the bulk of the committed tonnage by delivering fully built-up ULDs, but the freight forwarder has the option of tendering loose cargo as well. In that case, the carrier will build up its own ULDs, mixing in Flexport’s cargo with cargo from various sources going to the same destination.</p><p>When the freight forwarder delivers a ULD, it must follow very specific rules in the allocation contract, specifying things like dates, minimum and maximum weight, total volume, and specific contour. The aircraft may be carrying ULDs from dozens of sources besides Flexport, so the carrier defines these rules so that its flights are sufficiently loaded and properly balanced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZvjp0J4bjvQQyYdL7KfvQ.jpeg" /><figcaption>International carriers at LAX Airport Tom Bradley International Terminal.</figcaption></figure><p>A common type of allocation is the Block Space Agreement (BSA), and BSAs are further split into “soft” and “hard”. In a soft BSA, the forwarder can cancel its allotment on a particular flight with no penalty, if it provides the carrier with advance notice. In a hard BSA, the freight forwarder is responsible for paying the full cost of the allotment on every flight, even if the forwarder tenders no shipments on a particular flight. How much the forward pays is determined by a special term called called pivot weight.</p><h4>Pivot weight</h4><p>To understand pivot weight, let’s look at an example of a hard BSA contract between Flexport and Happy airlines.</p><ul><li>Origin: Hong Kong HKG</li><li>Destination: Los Angeles LAX</li><li>Flight number: HA123</li><li>Duration: January 1, 2019 to December 31, 2019</li><li>Days: Mondays</li><li>Departure time: 13:00</li><li>Arrival time: 18:00</li><li>Unit Load Device (ULD): W2</li><li>Max weight: 5000 kilograms</li><li>Max volume: 10 cubic meters</li><li>Allotment rate: $4 per kilogram</li><li>Pivot weight: 1000 kilograms</li><li>Over-pivot rate: $3 per kilogram</li></ul><p>This BSA specifies that Flexport gets a W2 (a specific PMC contour) ULD every Monday for all of calendar year 2019. For every flight, Flexport must deliver the fully built-up W2 to the Happy Airlines cargo terminal, ready to be loaded directly onto the aircraft.</p><p>A pivot weight of 1000 kilograms means that Flexport must pay for at least 1000 kilograms per flight, even if we tender less than 1000 kilograms. Those first 1000 kilograms are charged at the $4/kilogram allotment rate, so each flight costs Flexport at least $4000, even if we only tender a fraction of the 1000 kilogram pivot weight. If we tender more, then anything over 1000 kilograms costs $3 per kilogram. Furthermore, each W2 ULD can take no more than 10 cubic meters of total cargo summing to no more than 5000 kilograms.</p><h4>Equalization</h4><p>Many BSAs come with an equalization clause, which allows pivot weight to be averaged over a certain period, usually one month. In the case of the Happy Airlines BSA described above, let’s look at a hypothetical June equalization period. We have four flights in June, and imagine that on the first Monday we shipped 1000 kilograms, on the second we shipped 1000 kilograms, and on the third we shipped only 900 kilograms. So we’re 100 kilograms short of our pivot weight, meaning we still must pay for the full 1000 kilograms. But with equalization, we have the chance to make up those missing 100 kilograms at any time during the equalization period. In this case we have one Monday left in June, so if we ship an extra 100 kilograms over and above the 1000 kilograms we’d normally ship in order to achieve the pivot weight, then our pivot weights “equalize,” and we pay no pivot charges.</p><p>Equalization works in the freight forwarder’s favor, but it can be complicated to keep track of equalization periods. Part of an air planner’s job is to avoid pivot charges, and they can do that in part by intelligently managing equalization.</p><p>Allocations form the backbone of a freight forwarder’s capacity, but they exist only on a contracted basis, between pre-specified airports. What if a freight forwarder needs to move a shipment between two airports where it doesn’t have an allocation in place? Then it has two options: It can turn to the spot market, or it can move the shipment with a local partner (usually a co-loader or another freight forwarder).</p><h3>Spot Market</h3><p>There is no central, liquid, on-demand marketplace for air cargo, but rather an informal network of air planners and carrier representatives that communicate directly. For example, for air cargo coming out of Hong Kong, the spot market consists of a flurry of phone calls and WhatsApp messages between freight forwarders and carriers, inquiring whether the needed space is available and at what price per kilogram. If Flexport needs to move a 1000-kilogram shipment of six pallets from Hong Kong to Atlanta, where it doesn’t have a BSA in place, a Hong Kong–based air planner will contact all the carriers with flights between Hong Kong and Atlanta, provide the shipment details, and ask for pricing terms.</p><p>Recently, companies like <a href="https://www.cargo.one/">Cargo.one</a> and <a href="https://www.webcargonet.com/">WebCargoNet</a> have started to offer services to standardize this ad hoc booking process. They aim to decrease phone calls and emails in favor of online tools that offer greater visibility into carriers’ capacity and rates by integrating directly with carriers.</p><h3>Partner Agreements</h3><p>Finally, Flexport always has the option of utilizing a local partner to move the shipment at the point of origin. By partnering with co-loaders and local partners, Flexport can vastly increase its geographic service area, allowing it to quickly find capacity for any shipments. When we move a shipment with a partner, the partner decides how to ship it, using their own capacity mix.</p><h3>Flexport’s Private Air Service (our 747!)</h3><p>Flexport has one additional option for moving air shipments that most freight forwarders don’t have: Our own 747 freighter. We lease this aircraft from Plus Logistics and it flies routes between Hong Kong, Los Angeles, and Chicago.</p><figure><img alt="Flexport’s 747 taxiing at Hong Kong International Airport." src="https://cdn-images-1.medium.com/max/1024/1*IV0w3bTUuYm_CEBEPX6bWQ.jpeg" /><figcaption>Flexport’s 747–400F was built by Boeing in 2008 in Everett, WA.</figcaption></figure><p>Procuring our own aircraft is somewhat akin to signing a very, very large allocation, with about 40 ULDs per flight. Look for more information on the why and how in a forthcoming blog post.</p><h3>Matching supply and demand</h3><p>Now that we’ve briefly outlined what demand and supply are, how do we match them up? In other words, given a particular air shipment, how does Flexport decide whether to put it on our own 747, on an allocation like a hard BSA, on the spot market, or with a partner?</p><p>This brings us back to the concept of consolidation. Imagine you have a shipment of feather pillows, and you want to move it on the Happy Airlines BSA described above, which has a W2 with 1000 kilogram pivot weight and 10 cubic meters. The feather pillow shipment takes up 10 cubic meters, but weighs only 200 kgs. This volume would fit perfectly on the W2, taking up all 10 cubic meters. But it weighs only 200 kilograms, and the BSA specifies a pivot weight of 1000 kilograms, so you as the freight forwarder are committed to paying for at least 1000 kilograms.</p><p>On the other side of the spectrum, imagine you have a shipment of metal bars. It weighs 1000 kilograms, but has a volume of only 1 cubic meter. So you can fit it on the W2 and fill your entire pivot weight, but you’ve got 9 cubic meters of empty space left over.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n_Le5wF0pgo4gPFsDRoUyg.jpeg" /><figcaption>Flexport. We love gigantic airplanes.</figcaption></figure><p>A perfect consolidation would be some combination of these feather pillows and metal bars that fills the entire volume of the ULD while also reaching the pivot weight. In this way you utilize the full 1000 kilograms that you’re committed to paying for, and also avoid wasting any volume that’s available to you. (NB: There’s another concept, called chargeable weight, that affects how much the freight forwarder charges the client, but it doesn’t affect how we choose to assign shipments to ULDs. Chargeable weight may be the subject of a future blog post.)</p><p><strong><em>Traditionally, forming these consolidations — in other words, assigning shipments to ULDs — is the job of an air planner, and it’s done by hand with spreadsheets.</em></strong> These spreadsheets track things like delivery deadlines, remaining capacity, pivot weight utilization, and equalization. The air planner will assign each shipment to a flight in such a way that no flight is over capacity and every shipment gets to its destination on time.</p><p>But Flexport, like other large freight forwarders, has many allocations with many carriers, providing cargo capacity on flights all around the world every day. The spreadsheet method may be able to assign a particular shipment to *some* flight, but does that assignment yield the optimal consolidation? There is simply too much data and too many constraints for even the most cleverly constructed spreadsheet to manage, because shifting a single shipment can cause other shipments’ assignment to become infeasible.</p><p>Fortunately for our clients, Flexport loves math and data science, and we developed an algorithm that finds the perfect match for every shipment over every available flight, guaranteeing the lowest possible cost ever time. We do this using a field of operations research called discrete optimization, and we are excited to <a href="https://flexport.engineering/using-mixed-integer-programming-to-assign-air-cargo-to-flights-42437bae9945">share this with you in the next post</a>.</p><h3>Help us build the operating system for global trade</h3><p>Do you love math too? Are you looking for a role with, quite literally, global impact? <a href="https://www.flexport.com/careers/">Flexport is hiring</a> for roles all over the logistics supply chain, as well as <a href="https://www.flexport.com/careers/jobs/?department=Data%20Science%20&amp;%20Analytics&amp;location=">data science</a> and <a href="https://www.flexport.com/careers/jobs/?department=Engineering&amp;location=">software engineering</a>. Join us, and help us build the operating system for global trade.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFDBmH9EitmRptxZYKRqmA.jpeg" /><figcaption>Who needs windows? Not Flexport’s cargo.</figcaption></figure><p>[1] Integer programming, to be precise</p><p>[2] <a href="https://flightaware.com/live/findflight?origin=VHHH&amp;destination=KLAX">https://flightaware.com/live/findflight?origin=VHHH&amp;destination=KLAX</a></p><p>[3] <a href="https://www.boeing.com/commercial/777/#/design-highlights/freighter/freighter-capabilities/cargo-arrangements/">https://www.boeing.com/commercial/777/#/design-highlights/freighter/freighter-capabilities/cargo-arrangements/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7c0f980e2cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/flexport-engineering/air-cargo-supply-and-demand-at-flexport-b7c0f980e2cc">Air cargo supply and demand at Flexport</a> was originally published in <a href="https://medium.com/flexport-engineering">Flexport Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>