Heuristics in SAP logistics

In industry and its logistics – whether between plants or within – efficiency and profitability are increasingly ensured by just-in-time deliveries and high production volumes. At the same time, more and more complex products are being manufactured, which constantly increases the complexity of production and supply chains.

It can already be guessed that these two developments are negatively dependent on each other. This becomes even clearer when one looks at the mathematical foundations of goods flow optimisation, which of course concern both the distribution of components in production and the distribution of components to the end consumer. In fact, the underlying problem is NP-hard; in other words, if you want to solve it precisely, you need a lot of time or a lot of computing power.

Heuristics in practical use with route trains

The use of heuristics, i.e. approximations, is the best option in most cases. It is the most common and most promising approach for the optimisation of the flow of goods with SAP, as often a strong improvement is already sufficient if the software has a short runtime in return and can thus handle load peaks and a general increase in load well. Flexus AG has developed its own solution based on heuristics especially for intralogistics and the optimisation of route trains with SAP.

Basic framework/model of the Flexus routing control system

Visualization and easy editing of routes in routeoptimizer.

First, a framework for the mapping of tow trains was developed for this purpose. It essentially consists of a time module for unloading/loading transport orders, a time module for each stop and a driving time module. In addition, it was possible to use the infrastructure created by previous Flexus projects.

The RouteOptimizer is particularly worth mentioning here. With the help of this tool, the customer’s area can be maintained in a map as a kind of road network for all resources, including the route train. In addition, a layer model and a trailer scheme can be stored and supported directly in SAP.


Based on the resulting model, a first solution can be generated. Transport orders are organised into tours and scheduled for an adjustable number of route trains.

This first planning is already usable, but still far from being optimised. This is now done using the actual heuristics.

Optimization with meta heuristics

Currently, an algorithm from the class of heuristic search algorithms is used to improve the initial solution step by step. For each current solution state, neighbouring solutions are generated, i.e. a copy of the current solution is created that contains minimal changes (e.g. transport order is assigned to a different route). These neighbouring solutions are now evaluated and the best solution is selected. In this way, the scheduling is iteratively improved.

Use of the first-best solution in practice

To improve the execution time, the first best solution found can be used instead of the best solution. Especially when runtime is used as an optimisation criterion, this approach can be more advantageous.

This is explained by the fact that improvements are more often accepted on average, even if they are not the best improvements. This means that the improvement is steady rather than in “spurts”.

Soft contraints as a basis for evaluation

What is a “good” scheduling or planning is regulated by an adjustable evaluation. This defines a so-called soft constraint. This is because the resulting scheduling estimates should reach as high a value as possible, but such a high value depends on the situation and therefore cannot be set directly as a hard constraint.

Optimise route trains according to your requirements

The most intuitive planning estimate is the total route length, i.e. in the case of two plans with the same transport order, the plan in which the tugger train has to cover a shorter distance receives the best rating.

Of course, with the right settings, you can also focus on using as few route trains as possible at once, meeting all due dates, generating as few delays as possible or a combination of the criteria. These filter options can be individually adapted to your requirements directly in the SAP system. Furthermore, this structure also offers the possibility to perfectly adapt to any needs by adding customer-specific hard constraints. For example, a separate procedure for the transport of dangerous goods is possible.

Author Grasser D.

Author – Dominik Grasser

AI Developer

As part of his work at Flexus, he optimises the intralogistics of our customers with the appropriate optimisation algorithms. This is mainly applied in the optimisation of forklifts, tugger train logics and the efficient control of AGVs.