1

Given various features for a product, options for the features and the compatibility rules between the features, I would like to generate list of all feasible product configurations.

For example, my current use case is similar to configuring a laptop. Lots of variables like screen size, ram, cpu, motherboard and each with multiple valid values. We can also have constraint like this motherboard is compatible with this cpu etc. The output I need is list of all valid configuration for the laptop.

The scenario looks like a typical Constraint Satisfaction Problem (CSP). I tried CSP libraries like Minion, Choco etc. Unfortunately, they use only numeric variables and the compatibility rules is also a mathematical function.

I also tried http://labix.org/python-constraint where I used functional constraint and I provided my compatibility rules as If statements. This worked for small scenarios. But for my requirement, I would have 10 features and each with 4 to 5 options resulting in millions of configurations.

Can someone suggest best approach for my requirement?

Karthik
  • 75
  • 1
  • 7
  • Even counting solutions to easy constraint problems is often [#P-complete](https://en.wikipedia.org/wiki/%E2%99%AFP-complete), so you should set your expectations low for being able to find all the solutions efficiently. Finding the best solver for a given class of problems is a trial and error process at the best of times, so you're following the right path. Keep experimenting. Look into SMT solvers, too, if you haven't already. – Kyle Jones Jan 16 '19 at 00:38
  • Have you considered to model it with constraints over booleans? e.g. the presence of motherboards X, Y and Z gives boolean variables x, y and z and we have x+y+z=1. You would then need to give incompatibility constraints instead of compatibility constraints. If motherboard X is incompatible with disk A, we have x+a<=1. This is at least possible with Choco-solver. – Albert Hendriks Jan 27 '19 at 11:31

0 Answers0