How to get all permutation of a large vector?

9 visualizaciones (últimos 30 días)
Hildo
Hildo el 17 de Nov. de 2016
Editada: John D'Errico el 17 de Nov. de 2016
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Nov. de 2016
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 comentarios
Walter Roberson
Walter Roberson el 17 de Nov. de 2016
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 el 17 de Nov. de 2016
Editada: John D'Errico el 17 de Nov. de 2016
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by