I am really struggling with a problem where I need to "prune" down available scenarios to those that a user has defined as valid. Below is a small example of the problem I am trying to solve in .Net (C#). Given the levels / values shown below, the user could pick that there are only a few valid combinations, but if you imagine the levels below being 30-40 levels of data instead of the 5 I have shown, you could see my dilemma. I could need to go through millions to billions of NOT VALID combinations to get to the Valid combinations. There will be cases where all values in the level are applicable and some where only those combinations that the user has specified are.
Current Levels / Values of data:
Users have said that the valid combinations are:
*Notice all from level 4 are valid Receiver -> Sony -> 500 -999 -> Retail Receiver -> Sony -> 1000 - Up -> Retail
Results expected from the given 5 levels of information:
Receiver -> Sony -> 500-999 -> Open -Box -> Retail Receiver -> Sony -> 500-999 -> New -> Retail Receiver -> Sony -> 1000-Up -> Open -Box -> Retail Receiver -> Sony -> 1000-Up -> New -> Retail
The things I have tried are performant with small sets, but if I was to have a lot of levels and big gaps in the combinations which wouldn't allow me to prune the valid combinations until I was deep into the levels, I am running into major performance problems. I am obviously not tackling the problem incorrectly.
Any other views or suggestions on tackling the problem would be greatly appreciated.