Hello, I need to write scripts in which I need to generate all posible unique combinations of an integer list. Lists are a minimum 12 elements in size with very large number of possible combination(12!)
I hacked a few lines of code and tried a few things from Python CookBook (http://aspn.activestate.com/ASPN/Cookbook/), but they are hell slow. Does any body know of an algorithm/library/module for python that can help me in generation of these combinations faster """ONLY REQUIREMENT IS SPEED""" Example Problem: Generate all possible permutations for [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2] [1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2] (notice an extra 2 ) eliminate some combinations based on some conditions and combine the rest of combinations. And now generate all possible combinations for resulting data set. Hope you get the idea. Thanks PS: Tried matlab/scilab. They are slower than python. -- http://mail.python.org/mailman/listinfo/python-list