This is a broad and interesting topic with huge potential, seen both from the technical and business perspectives. A general broad-scope calculation framework can have applications in countless subject areas from financial planning to simulation of global warming in science, saving hundreds and thousands of hours invested in hard code programming which often creates non-manageable complexity. A rule based calculation framework is in a sense a high level analytical programming language to organize and simplify complex mathematical relationships. Configuration rules are the syntax, mathematical models of function blocks are the buildings stones of this language. This article is a general introduction. I plan to write more about calculation frameworks in my future related articles.

A rule based calculation framework is a fully configurable calculation software. The framework is configured primarily by combining standard block functions in the library each with clearly defined inputs and outputs, and by setting values for the available calculation parameters. All inputs and outputs as well as other calculation (or configuration) parameters are tables. With tables I mean a more general form of matrices that can contain not only numbers, but any kind of fields like text attributes and dates. How these tables as generic information units are stored and fed to the framework is a secondary interface and technology issue; not directly related with the mathematical model. For example, input tables can be fetched directly from a relational database, or they can be fed into the framework in an XML file. Similarly, all outputs (results) can be written directly into a database or into an XML file.

A calculation framework is often defined for a limited business and requirement scope. For example a calculation engine for financial planning, another calculation engine for management and performance fee calculations, yet another engine for analytical marketing. Whatever the scope is, if an alleged calculation framework can’t implement all the calculations by configuration only (i.e. without any hard code programming) within its defined scope, it doesn’t actually deserve its name. In such cases, this often misused and abused term “calculation engine” is just a marketing gag; it defines what the user expects, but not what really the framework does.

Obviously, the technical configurability alone won’t be a real added value if it is only about shifting the programming burden and responsibility to the end user. After some basic training about the framework, the whole configuration should be easy enough for end users with minimal support from the specialists to save everyone time and head ache. This is the purpose of a rule based calculation engine; it should improve the general clarity of mind, and reduce the code mess and complexity. The reusable library functions should not just be implementation units in machine language that are only understandable by IT specialists; they should help users to organize their own minds to overcome the perceived complexity. For that purpose, they should have a clear focus and meaning in mathematical terms. Each function block in the framework should represent a mathematical concept, even if some of these concepts need to be invented from scratch.

The figure at left depicts a limited-scope calculation framework for simple price calculations with given percentage margins for each product category. As you see, the input and output data are tables with given fields which can be numbers, dates or attributes. All the calculation or configuration parameters are also tables.

### A general (or generic) calculation framework: Is it possible at all?

After some years of experience in different areas like artificial intelligence, analytical marketing, financial planning, quantitative portfolio optimization and performance fee calculations, I think today that a general, broad-scope calculation framework is not only possible, it is also necessary. I will try to explain the reasons one by one.

*Pressure of new requirements and time*

A limited-scope calculation framework works fine as long as the requirements remain within this limited scope due to the nature of business. But in most cases in practice, new requirements push a limited-scope framework to its limits enforcing it to become more and more general in its functionality. If the calculation engine is not modeled with the necessary foresight for possible future requirements and mathematical scalability, the alleged framework can soon become a mess of patchwork code with a complexity beyond control.

*Common elements of different calculation frameworks*

If you had experience with limited-scope calculation frameworks for different subject matters, like financial planning, cost or revenue modeling, analytical marketing and investment performance, you would soon realize that all these different frameworks have some common elements like standard allocation and distribution functions, reconciliations at different levels (i.e. attribute combinations), date and attribute filters, groupers and samplers, sequential multiplexers, discrete integrators and differentiators, automated workflows and solvers. This means, once a solid calculation framework is developed for a given subject area, the same framework can be used in many other areas with minimal extension.

Put another way from the organizational point of view, if a team is able to develop a calculation framework for a certain subject area (which is not too narrow), it will possibly be able to extend the analytical model and functionality smoothly for other subject areas without losing the control over complexity. The required competences are quite general: Complementary analytical modeling and problem solving skills with some amount of experience, foresight and imagination.

*Market scope and required competences*

A company serving a small market niche can hardly develop a general calculation framework itself because the market niche can hardly finance employees with required competences on a sustainable basis. That is, if you want to develop and market a general calculation framework, you need to have a broad business and market scope.

On the other hand, if you have a general calculation framework, it doesn’t make sense to use it only for a limited business scope. As mentioned at the beginning of this article, a general calculation framework is an invaluable asset for many fields in business and science.

*General mathematical models are required for setting standards*

The real power of a general (or generic) calculation framework will come with standards, that is, standard configuration files. Just imagine, how the configuration files could be used if there were a universally accepted generic calculation engine: Scientific communities could exchange configuration files to discuss about the dynamics of human activities and ecology, finance communities about the mechanisms of global currency movements, controlling and management departments of companies about the forecasting method, and so on, provided that the configuration files can be presented in a transparent and understandable way. However complex a calculation is, all you need is the configuration file to replicate, simulate, analyze and discuss the calculation.

Standard configuration files could even be used for defining official contracts. Imagine for example that a fund management company defining its management fee structure (i.e. fee calculation method) with some standard configuration files. As a potential investor, you can download the standard configuration file in internet, simulate the fee calculation under different scenarios and negotiate with the management company:

- “I can accept this calculation method, only if such and such parameters are set to such and such values”, or
- “I don’t accept the contract type ManFee-A (configuration file); it has such and such drawbacks for me. I want to invest with ManFee-B!” These standard configuration files representing different fee calculation methods could even be declared in the fund’s prospectus for each share class.

There are in fact some ongoing efforts for formulating standard calculation methods for different fee types in the fund industry. There are however some technical and organizational challenges. One of them is related with the mathematical model. In order to define standard contracts for calculations, you need to either

- limit the scope of calculations with some regulations, so that the calculations can be configured with simple limited-scope calculation frameworks, or
- a broad-scope general calculation framework.

A successful standardization harbors a potential network effect in marketing; the company with the most widely accepted framework standards is expected to gain further momentum in expanding its market share.

*Is a general rule-based calculation framework really possible?*

My own experience showed me that it is possible to design a generic calculation framework provided that the framework accommodates user-specific ad-hoc functions (or formulas) in a well-structured way. With a place for ad-hoc formulas in the whole structure (for example standard function routers for ad-hoc functions), all kinds of table calculations can be configured with a consistently high-level analytical modeling language.

Another reason why I think a generic calculation framework is possible: I have developed a concept and a prototype for a generic rule and contract based calculation framework myself, which is almost complete for a start for various applications. I am currently planning to convert this concept into a business idea. I am open to any suggestions and possible synergies; please don’t hesitate to contact me if you are interested in calculation frameworks as an investor, entrepreneur, customer, developer or product engineer.

Otherwise, as usual in real life, the answer to the question above (is it possible?) will probably be a matter of degrees. The success and performance of a generic calculation framework can be measured with respect to its primary goals that can be summarized as follows:

*Efficiency:*Ability to implement complex calculations in a much shorter time (through configuration), compared to customized hard code programming*Scope:*Ability to cover a broad spectrum of calculation requirements (a 100% coverage will probably not be possible)*Conceptual transparency and integrity:*Ability to make seemingly complex calculations more transparent and understandable to a broader audience through clean and simple (that is, as simple as possible) understandable mathematical modeling*Standardization:*Ability to enable standardization for certain fields of business and science*Reducing complexity:*Ability to keep complexity of calculations under control; increased software quality through well-tested reusable standard function blocks

**Tunç Ali Kütükçüoglu**, 10. April 2012