I appreciate the help and advice.
Once I had a set of ABC, I wouldn't want the CBA or BCA type of sets. Much like a poker hand, order doesn't matter. My end goal isn't really to display any of this. It's probably worse, though. I wanted to, for each combination, run an analysis. Which would add more time, so obviously it isn't feasible the way I'd been trying to go about it.
Just out of curiosity, I'd still be interested in an algorithm to do the "create a list of all combinations" thing for smaller lists. I never thought about that being difficult until I started trying to do it. And with smaller lists, I can do it manually. But I couldn't figure out how to program it.
Regardless, that wasn't an end-goal.
Maybe there is another way. I'd thought building all possible sets, then looking for sets that meet certain criteria was the way to go, but you've convinced me that I need a new plan.
Lets say we have a list of items, A..Z, and each item has two attributes, 1..25. (Real-world, I expect to have 100-200 items, and each item will have two attributes. I believe their are between 20 and 30 possible attributes.)
What I want to accomplish is to find sets of items (usually 6 in a set, but that could vary) that have a combination of 12 (again, # could vary) attributes. Also, in some situations, I might need certain attributes + one wildcard that could be essentially anything, so long as it doesn't duplicate one of the other attributes in that set.
For instance, lets say I wanted to find 3 items that had the attributes 2,3,5,7,8,9.
In a previous step, I've already trimmed a lot of items from my list, because they don't contain any of the needed attributes. If they have one of the required attributes, and another attribute that isn't in the required list, I've kept that item available, as it might fit in with a wild-card.
My item list might be something like this. (item name, and it's two attributes.)
A: (2, 9)
B: (3, 7)
C: (9, 11)
D: (1,11)
E: (5, 8)
F: (6, 3)
G: (4, 15)
H: (4, 7)
I: (3, 7)
J: (6, 3)
K: (2, 8)
etc.
A: (2, 9)
B: (3, 7)
E: (5, 8)
would be a valid set, with all the attributes I'm looking for. 2,3,5,7,8,9.
Ideally, order in the list also matters. For instance, in that example, item B has attribs 3, 7. Item I also has attribs 3 and 7. In my final set, I'd prefer item B over item I since the B was listed first. Essentially, as sets are created, those items will be removed from my list, and the items below them will move closer to the beginning. New items added will be added at the bottom of the list. Items which have been waiting the longest to be made part of a set (item B) should be favored over their exact counterpart (item I).
In some cases, I'll be looking for a set like "2,3,5,7,8,X". X in that case is a "wildcard" which any attribute can fill. However, it should not be a duplicate of any of the other attributes in the set. (So in that example, X can be anything except 2,3,4,7,8.)
As I said before, my original thought was to generate a list of all possible combos, then look at each of those combos to see if it met the requirements for a set. That doesn't appear to be feasible. Maybe you can suggest a better way.
The way this works out now (with no program helping) is that a person is looking through trying to come up with a set. As sets are found, the items in that set are removed from the item list, and we look for a new set. Eventually, we don't have items with the right attribute to make a set, and things go on hold. But new items come in, are added to the bottom of the list, and we have to look again to try and make a set. The sets we are looking for also change periodically. Some have wildcards, some don't.
The item list here is a subset of a bigger item list. That list has many more attributes. This subset is made by pulling items out of the master list that have at least one attribute that matches the set we are trying to build. (If the set has no wildcard spot, then only items with two matching attributes will be used to build the sub-set.) |