All combination of certain min size

1 view (last 30 days)
Hi, I need to compute all possible combination out of 70 assets that include at least 20 of them.
A binary 0/1 index output would be ideal.
Thanks
  1 Comment
the cyclist
the cyclist on 17 Jan 2012
I estimate that there are 2.6e17 ways to do that. What exactly is it that you want?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 Jan 2012
Because of the "at least 20 of them", there will be 1180493606926365010344 of them. It would be a lot shorter to calculate the asset combinations that are not included; there are only 98013791046293080 of those.

More Answers (2)

Sean de Wolski
Sean de Wolski on 17 Jan 2012
nchoosek(70,20)
Warning: Result may not be exact. Coefficient is greater than 1.000000e+015 and is only accurate to 15 digits > In nchoosek at 64
ans =
1.6188e+017
So it's going to take a really long time and use most of the computer memory in the world to do this:

Tommaso Sanzin
Tommaso Sanzin on 17 Jan 2012
Roger! I clearly did not calc the exponential magnitude of the problem. I guess looking for any combination of size 20 out of a universe of 70 is still too much... Thanks for the answers!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!