[Numpy-discussion] Combinations of objects (?)

Alan G Isaac aisaac at american.edu
Mon Oct 20 07:48:13 EDT 2008


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?

Alan Isaac




More information about the NumPy-Discussion mailing list