My raw data is composite, but for simplicity sake let's say they consist of three elements. One might consider a sample set thusly.
[A,a,1] [A,b,1] [B,b,1] [B,b,2] [C,b,3] [A,c,3]
I need to create a subset that satisfy two key criteria.
- All combinations of the two last columns is represented (lower case and numeric)
- All upper case (first column) is represented at least once.
... in as few rows as possible. The data is not evenly distributed, meaning that e.g 80 percent of the rows in the input data may have b,1. If that was the case, it would be wasteful to include A,b,1 row, because I would have to include A,a,1 as well in order to make sure that a,1 combination is represented.
Though large data, the data is in memory. Accessing and iterating is relatively cheap. The data is static and may be processed over multiple passes .
Language is C#.
I'm not too happy about the title of this question, so if there is any key term that better describes this problem, feel free to comment/edit.