SAP TM Optimizer performance – An ABAP developer’s point of view
In the last couple of month I got several questions regarding the TM optimizer and its performance. Therefore I decided to write this blog which should give some information how the optimizer works and some tips to improve performance in your scenario (for more information regarding the optimizer and optimizer performance you should check out SAP note 1520433 and the blog series Effective Optmization Series).
Let me start with some vague information about the optimizer in SAP TM.
When you run the optimizer from TM standard default there are 3 steps which are processed: The optimizer pre-processing, the optimization, and the optimizer post-processing (check process controller strategy VSR_DEF).
In the pre-processing all the relevant data are collected and converted to the optimizer format. This means that data about all selected freight units, freight orders, and resources needs to be collected. Furthermore information about all the possible routes through your transportation network are determined. Also optimization context data needs to be collected. This context includes e.g. orders on selected resources within the planning horizon, to let the optimizer know when the resources are already in use.
The optimizer itself is an algorithm which creates a valid transportation plan and try to optimize the solution regarding the planning costs which are set in the planning cost settings of your planning profile.
In the post processing the optimizer solution is stored back into the TM system which means all the changed data are saved in the system.
There are two main points which will cost performance: volume & complexity. Working with the optimizer you should try to keep one principal in mind “take the data needed, but not more”.
One important point in reaching a good optimizer performance is selecting right data. Two very important settings here is the selection horizon and the planning horizon. For the right planning horizon you need to analyze your own business. If you are running a day to day business the planning horizon usually will only cover the next few days. It you need to make plans over the next month’s your planning horizon covers a longer time period. Maybe you are using some offset to get your plans ready one or two day before execution. In order to reach a good optimizer performance your selection of freight units and freight orders should depend to the planning horizon. For sure all of those horizons should be as small as possible to improve performance.
The optimizer will never plan any freight unit which have their pick-up and delivery window outside the planning horizon. Therefore avoid to process any of those freight units with time selection attributes in the selection profile.
In the selection profile you can furthermore exclude all freight units which are already planned. Those freight units would be fixed by the optimizer anyways if you don’t also select the freight order which they are assigned to. If you select freight orders the assigned freight units will be added to your selection anyways in order to process them. Please keep in mind that the optimizer will delete the currently planned freight orders and start from scratch for the assigned freight units if you process them in an optimizer run without using incremental planning.
Inthe planning profile you can control how long the optimization should run. As more time the optimizer gets as better the results will be from a planning cost perspective.
Please also check out this setting if you are concerned about the overall optimization time. TM default is set to 20 seconds the engine can use.
Be aware that the right optimizer runtime setting is hardly depending to your scenario. It’s definitely not a good idea to just reduce the runtime in order to get faster response!
Over the last month we did several improvements for the optimizer performance. Those are contained in the following set of notes for optimizer pre- and post-processing.
Here are some of the recent SAP Notes you should implement when facing performance issues. I will try to update the list from time to time.
Optimization in general: 2225934, 2478787, 2366170
Optimization resulting in creating multiple freight orders with HBL: 2225719
Optimization using incremental planning: 2225741, 2257414
Optimization with carrier selection: 2188496
Optimization with charge calculation: 2184962
More about performance you can find here.