Skip to Content

SAP uses Gecode, an award-winning constraint solver, in S/4HANA for advanced variant configuration

In 2015, the SAP Variant Configuration development team started to develop the new state-of-the art configuration engine. This engine was first made available in SAP S/4HANA in summer 2017 within SAP S/4HANA for advanced variant configuration. At the core of the configuration engine, SAP has chosen to leverage the open source library Gecode (

Gecode is a highly-efficient constraint solver, which is being developed under the lead of Prof. Christian Schulte.

Prof. Christian Schulte is a professor of computer science at the KTH Royal Institute of Technology in Stockholm. His research interests include constraint programming, programming systems, and distributed systems. Currently, he works on an approach for constraint-based code generation in compilers, and on systems and methods for constraint programming. He is heading the development of Gecode.

Since its founding in 1827, KTH Royal Institute of Technology in Stockholm has grown to become one of Europe’s leading technical and engineering universities, as well as a key center of intellectual talent and innovation.

KTH is Sweden’s largest technical research and learning institution and home to students, researchers and faculty from around the world, dedicated to advancing knowledge.

The reasons why SAP chose Gecode are manifold. For one, constraint solving captures the essence of a product configuration engine. A constraint model consists of model variables with their domains (these are the product’s characteristics) and constraints describing the admissible combinations of values for the variables (these capture valid product configurations). Such constraints could be given, for example, by tables, arithmetic formulas, string expressions, or expressions over sets. A constraint solver detects and removes values which cannot possibly appear in a solution to the system of constraints. In terms of product configuration this means identifying those characteristic values, which can still be added by the user to the current partial configuration without causing an inconsistency. To guide the customer to a consistent configuration, a product configurator repeats this step of computing the remaining set of possible characteristic values after every customer choice. Due to this obvious suitability, constraint solving applied to product configuration is one of the big success stories of applied artificial intelligence research. SAP sees multiple advantages in making Gecode the constraint solver of choice.

Gecode is radically open for programming: It can be easily interfaced to other systems. It supports the programming of new constraints. New variable domains can be programmed at the same level of efficiency as the variables that come predefined with Gecode.

Gecode has a comprehensive set of features. Among others, it features constraints over integers, booleans, sets, and floats. It implements more than 70 constraints from the Global Constraint Catalog (, and many more on top. This set of supported constraints covers a large part of the syntax of the S/4HANA for advanced variant configuration and provides many exciting new syntax elements on top.

Gecode offers excellent performance with respect to both runtime and memory usage. It won all gold medals in all categories at an annual benchmark challenge for constraint solvers, the MiniZinc Challenge (, for five years in a row, from 2008 to 2012. Given that users of product configurators expect sub-second response times no matter how complex the configuration models are, this world-class performance is an important asset.

Gecode uses a test suite with almost 50,000 different test cases reaching a test coverage close to 100%.

Gecode is distributed under the MIT license ( and is listed as free software by the Free Software Foundation (

“Gecode really brings all the qualities needed for building a state-of-the-art configuration engine. Because of its comprehensive functionality, its performance and stability, and its openness, it is the perfect building block for SAP’s Advanced Variant Configuration.

We are excited to make such a powerful configurator available to SAP customers
directly embedded in SAP’s flagship product, S/4HANA.

says Dr. Conrad Drescher.

Dr. Conrad Drescher is a research and development expert in SAP’s team, and has researched constraint satisfaction problems at the University of Oxford (

Besides all these advantages for Advanced Variant Configuration, using Gecode has turned out to be a fruitful collaboration for both parties. On top of smaller improvements, Gecode has been extended to provide an execution trace for constraint solving at SAP’s request.

“Responding to such application requirements is absolutely vital for
an open source project’s continued success.
The collaboration with SAP has proven really useful for Gecode!”

Prof. Christian Schulte says.

For a blog post describing the proprietary Gecode extensions the Advanced Variant Configuration development team together with the Fraunhofer Institute for Industrial Mathematics (ITWM, has developed, see here (LINK).

For further information on S/4HANA for advanced variant configuration, please go to the following articles:

ON AIR with Sven Denecken:

Business view:

Technology view:

For further information, please contact us at

Be the first to leave a comment
You must be Logged on to comment or reply to a post.