[Numpy-discussion] Combinations of objects (?)
Mon Oct 20 11:05:11 CDT 2008
On Oct 20, 11:02 am, "Andrea Gavana" <andrea.gav...@gmail.com> wrote:
> Hi All,
> On Mon, Oct 20, 2008 at 12:48 PM, Alan G Isaac wrote:
> > On 10/20/2008 5:20 AM Andrea Gavana apparently wrote:
> >> this is probably a very silly question, but combinatorial math is
> >> not exactly my strength and I am not even sure on how to formulate the
> >> question. I apologize if it is a very elementary problem.
> >> Let's suppose that I have 60 oil wells and 3 surface facilities. Every
> >> well must be tied-in (linked, attached) to one and only one of these
> >> surface facilities. No orphan well is allowed (i.e., a well not
> >> attached to any surface unit) and no multi-links are allowed (i.e.,
> >> one well attached to 2 or more units). Is there any simple way in
> >> numpy (scipy?) in which I can get the number of possible combinations
> >> of wells attached to the different 3 units, without repetitions? For
> >> example, I could have all 60 wells attached to unit number 1, then 59
> >> on unit 1 and 1 on unit 3 and so on...
> > I think you are just asking how many ways you
> > can put N marbles into K boxes, with no restrictions.
> > Since there are K possibilities for each marble,
> > wouldn't the answer to your problem be K**N?
> Uhm, I am not sure, I imagined TJ answer is correct by reading the
> Python thread he kindly posted. As there shouldn't be repetitions
> (i.e., each combination is unique) and every single well must be
> attached to one and only one unit, it seems to me that 3**60 is a very
> big number :-D
> But combinatorial things are pretty obscure to me...
> In any case, thanks to you all for your suggestions.
> "Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/
> Numpy-discussion mailing list
I briefly looked at the thread by TJ and the discussion is on
indistinguishable object, i.e. in your case if you only care about how
many but not which wells are connected to a given facility.
Think of Alans answer in terms of numbers in base 3, you have 60
digits (wells), and each digit can be either 1,2 or 3 (facility to
which well is assigned to). The total number of numbers that can be
represented this way is 3**60.
e.g with 4 wells: 3**4=81 possibilities
easy to check for 2 wells: 3**2=9 possibilities
More information about the Numpy-discussion