Yes, this is very different from what I was imagining.  You use the
word permutation many times when I think you mean combination.  A
permutation assigns some sort of meaning to the order in which they
elements are chosen.

I think you pretty much have a solution in the bag.  A recursive
algorithm would get the job done.  You would want to right a function
that does something like this (but hopefully much better thought out):

1.  Count the number of cores that are possible on the map
2.  If the count is non-zero:
    2a.  Find the next possible core in on the map (if none left exit
loop)
    2b.  Send the map, minus the core planets we found, recursively
back into the function
    2c.  Loop back to 1
3.  If count is zero:
    3a.  Compare the depth of the recursion to the best found so far
(the depth is the number of cores found)
    3b.  If greater, mark this configuration as the best found so far.

This is an exhaustive search of the possibilities.  Worse than that,
since it is looking at permutations of the cores and not combinations,
it will also generate the same configuations multiple times.  This
means that choose core a then choose core b and choose core b then
choose core a will be generated seperately.  This will increase the
computation time by something like the factorial of the number of cores
in the final solution?, which probably is not acceptable.  It is not
immediately clear to me how to beat this since the recursion sort of
forces you into this permutation calculation.

Someone will come up with a better solution if they are interested.  I
hope this is not completely hair brained.

Zach


Cyril misc wrote:
> here are all the explanation

Reply via email to