Re: Permutations & Computer capacity
- To: mathgroup at smc.vnet.net
- Subject: [mg17005] Re: Permutations & Computer capacity
- From: "vdmcc" <w.meeussen.vdmcc at vandemoortele.be>
- Date: Sat, 10 Apr 1999 02:13:37 -0400
- Organization: EUnet Belgium, Leuven, Belgium
- References: <7ec4ji$alq@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
hi Francisco,
if you go beyond 8! elements, it might be wise to try and write a short Do
loop to evaluate the permutations one at a time, and only keep the result (a
running weighted average, a running sum or an extremum value, whatever you
are calculating).
You can avoid having to generate all n! permutations at once by using
NextPermutation from the DiscreteMath`Combinatoria` add-on.
In this way, only your patience will be tested, not your memory (;-)).
hope this helps,
wouter.
Francisco Gutierrez wrote in message <7ec4ji$alq at smc.vnet.net>...
>
>I developed a notebook to evaluate the Shapley value (votation power) of
>a list of parties in a committee. A list to be evaluated looks like:
>{{partyA, 5}, {partyB, 8}...{partyn, X}}
>
>Everything works ok but...disgracefully producing the Shapley value implies
>working with permutations. This means making n! evaluations (n the length
>of the list).
>
>And when I have a list of more than 8-9 parties, the program gets stuck.
>Now, 9! is not such a big number.
>
>I thought that perhaps my programming was not efficient enough, so I made
>the following try:
>Range[12]
>Permutations[%]
>After a couple of minutes, I got the answer "Exiting-out of memory"
>I have a Pentium II with 128 RAM, 4 free gigas in hard disk and a 300 and
>something processor (my platform is windows 95).
>
>Is there something wrong with my computer? Is there a way to overcome this
>limitation?
>
>Many thanks
>
>Francisco Gutierrez
>
>