# Optimization of Rule Driven Systems

What is optimization of rule driven systems about? Just imagine you are a manager who uses the SAP Decision Service Management solution. You speficied and implemented business rules for a business process (think of fraud detection) that scans invoices for anomalies using BRFplus. Everything is OK and the Decision Service produces workitems for a team but now many people are ill or in vacation and now you have to adjust the result set by defining a random sample according some or all of the following criteria: size of the team resp. estimated working time, qualification expected benefit. And this is what this blog is about.

Recently Carsten Ziegler announced that rule evaluation and predictive models are on the roadmap of SAP Decision Service Management. This is a very important feature since after a implementation of business rules those need to be refined and optimized. I’m already looking forward to those features and I hope I’ll be able to them in a Customer Engagement Initiave. But before these tools are available I’ll write down some simple but somewhat effective approaches. If you are using BRFplus for automated checks like anomaly detection (think of fraud) it is possible that the result of the rule evaluation is that a user has to do a manual control. Usually those controls are performed by a group of experts. If your Decision Service (think of a BRFplus function) detects anomalies that will be processed using workflows it is possible that the number of workitems needs to be reduced to a certain factor depending of the size of organizational unit who has to complete the workflows. In fact the size can change due to illness or vacation.

In the simplest case you know from experience (or using certain tools like Process Observer) that the number of workitems have to be reduced be a certain factor (think of 0.5) then you can choose a special BRFplus expression type that calculates a random value to reduce the number working set by that factor. As a result a random sample will be checked.

But usually the situation is more difficult since the result of a Decision Service is a classification that gives back a classification and sometimes priorization of the tasks, think of following: “high loss”, “medium loss” and “low loss”. In this case a feasible strategy is to restrict to “high loss” and perhaps “medium loss”. Restricting to fix categories is problematic because a possible result is that fraudsters optimize their strategy according to that strategy. So it is feasible to work with random samples of the result of a decision service where the random values are defined in a way that the expected business value is maximized.

This will lead to exactly the examples I discussed in my blog how to perform about linear optimization in ABAP. I got many comments on this blog and some SAP experts found the linear programming approach complex but maybe they will give the model a second look in the context of business rules and process optimization.

### Task 1: Reduce the Working Set with constraint on Working Time of the Team

Supposed that you know (from experience and using SELECT statements) that in a certain period a Decision Service creates c_{1} workitems of type 1, c_{2} workitems if type 2 and so on. Each workitem of type i requires t_{i} time units . Then the task is to find (x_{1}, x_{2}, …, x_{n}) so that many of them – i.e. the sum of x_{i }–is maximized with regards to the following constraints:

- each x
_{i}<= c_{i}since you will find a fraction of expected workitems of each type - x
_{i}>= 0 since this fraction needs to be positive - the sum of x
_{i}* t_{i}<= sum of your whole time of your organization unit

As the result you find fractions, think of percentages, of the workitems of each type that should be checked. So those x_{i} can be used in a random function that generates a random sample of each workflow type i.

### Task 2: Maximize an expected benefit of a estimated Working Set with constraint on Working Time of the Team

If in above model you know that the types of workitems have a different priority (the completion of a workitem of type i will lead to a benefit b_{i}) then you can use the model to maximize the sum of x_{i} * b_{i}.

### Summary

By separating business logic from business processes you make processes of SAP Business Suite more transparent and easier to change. But this is only the first step, in SAP Business Suite is an integrated system with amazing capabilities:

- you can perform operational reporting on workflows and built-in processes using process observer
- you have solutions for decision management
- you can perform mathematical optimization

Combing them you can make corporate decision management more flexible and optimize your business processes and their business value. SAP NetWeaver Decision Management has the potential to make that approach much easier. With HANA this will come to a new level since you can analyze your data in real time, analyze your processes using SAP Operational Process Intelligence and perform complex calculations on HANA. In my opinion the combination of SAP Operational Intelligence and SAP Decision Service Management will lead to a new evolution in SAP Business Suite. I think this will take some time but you can start right now using the optimization capabilities of SAP NetWeaver.

Hi Tobias,

Good blog post: rule driven systems need a separate layer on top of them to enable them to 'learn' and to be able to optimize them. Not only in the context of workload, but also to improve the system, and to let it learn from its own 'decisions'.

I'm sure you know James Taylor who has written extensively about this very subject, especially in his excellent book Decisions Management Systems.

I'm very curious when these capabilities will to come to Decision Service Management.

Cheers, Fred

Tobias,

Good post. It would be so nice if processes or tasks would become more rules-driven themselves. You would get basically more declarative ("intent") flows instead of the imperative ("optimization") railroading of workflow, NW BPM, source code.

Add some planning capabilities (in the NP-complete problem space) like Drools Planner (http://www.optaplanner.org/) and you have a truly kickass platform to support Business Processes (or better: Goals), a genuine "Business Navigation System", as some people outside and inside SAP are saying.

Cheers, Wout

Thanks for your comments. At the moment I'm working on some cool things like applications of Dempster Shafer theory (https://en.wikipedia.org/wiki/Dempster%E2%80%93Shafer_theory) for decision management. I'll blog about it as soon as I finished my work.

Best Regards,

Tobias