How to get all permutation of a large vector?

조회 수: 4 (최근 30일)
Hildo
Hildo 2016년 11월 17일
편집: John D'Errico 2016년 11월 17일
How to get all permutation of a large vector? (50 elements) I need this to generate a Simulink simulation with each combination result. So the ideal is some generation in a loop.

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 17일
If you were able to process the entries at a rate of 5 GHz (that is, you were able to process 5*10^9 complete entries per second), then it would take you 1.93 * 10^47 years to process all 30414093201713378043612608166064768844377641568960512000000000000 permutations.
But if you have a yotta-yotta year to spare,
  댓글 수: 4
Walter Roberson
Walter Roberson 2016년 11월 17일
If you processed at the same rate that I described above, then a vector with 30 elements would take approximately 1.68 * 10^15 years.
This figure needs to be understood as a very very rough approximation. The rotation of the Earth is slowing down due to gravity interactions with the Moon, so the very meaning of "year" will change, even if only in terms of "days". On the other hand, apparently the Sun is likely to only last about another 2.2 * 10^9 years and if the Earth survives that, you can be sure that "year" will have a very different meaning.
If you were to compare age of the Universe itself to the age that the Universe would have at the end of the 1.68 * 10^15 years, it would be like the first 4.38 minutes out of a year.
You should probably rethink your strategy.
John D'Errico
John D'Errico 2016년 11월 17일
편집: John D'Errico 2016년 11월 17일
Yes, but with Moore's law in operation, before 10^15 years have passed, computers will be fast enough to process this easily. In fact, we can even predict when computers will be capable of solving the larger problem, of computing all permutations of 50 elements. (In theory, assuming we are still alive by then, and Skynet has not managed to do nasty things to us.) The thing is, by the time we are actually capable of solving the desired problem, this question will have been replaced by someone wanting to generate all permutations of 100000 elements, or something as bad.
So, even with Moore's law on our side, we can't win. Lets just call it John's law:
No matter how big or powerful their computer may be, there will always be somebody wanting to solve a problem that is ridiculously large, far beyond the capabilities of that computer, or even any computer in the known universe.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Marine and Underwater Vehicles에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by