Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13094

recursive algorithm for balls in numbered boxes

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bounces@nabble.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'url:py': 0.07; 'python': 0.08; '(also': 0.09; 'context:': 0.09; 'iterator': 0.16; 'message- id:@talk.nabble.com': 0.16; 'nabble.com.': 0.16; 'received:192.168.236': 0.16; 'received:192.168.236.156': 0.16; 'received:216.139': 0.16; 'received:216.139.236': 0.16; 'received:isper.nabble.com': 0.16; 'received:nabble.com': 0.16; 'url:nabble': 0.16; 'url:old': 0.16; 'written': 0.16; 'appears': 0.20; 'this?': 0.21; 'archive': 0.23; 'work,': 0.23; 'extensively': 0.23; "python's": 0.24; 'code': 0.25; 'skip:b 20': 0.26; '(the': 0.28; 'problem': 0.28; 'module': 0.30; 'class': 0.30; 'list': 0.32; 'does': 0.32; 'anyone': 0.32; "isn't": 0.33; 'to:addr:python-list': 0.33; "i've": 0.34; 'creates': 0.34; 'charset:us-ascii': 0.36; 'skip:" 10': 0.36; 'but': 0.37; 'should': 0.38; 'received:192': 0.39; 'suggestions': 0.39; 'appreciated.': 0.39; 'to:addr:python.org': 0.39; 'mailing': 0.39; "i'd": 0.40; 'contact': 0.66; 'view': 0.67; 'numbered': 0.84; 'subject:balls': 0.84
Date Sat, 10 Sep 2011 17:43:39 -0700 (PDT)
From "Dr. Phillip M. Feldman" <Phillip.M.Feldman@gmail.com>
To python-list@python.org
Subject recursive algorithm for balls in numbered boxes
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Nabble-From Phillip.M.Feldman@gmail.com
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.959.1315701829.27778.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1315701829 news.xs4all.nl 2457 [2001:888:2000:d::a6]:36147
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:13094

Show key headers only | View raw


I've written a recursive class that creates an iterator to solve a general
formulation of the combinatorics problem known as "balls in numbered boxes"
(also known as "indistinguishable balls in distinguishable boxes").  The
code has been extensively tested and appears to work, but isn't terribly
elegant.  Any suggestions about how to improve it will be appreciated.

Also, I'd like to get this functionality into the Python's `itertools`
module (the present set of combinatorics functions in `itertools` does not
include "balls in boxes").  Does anyone know whom I should contact about
this?

Phillip

http://old.nabble.com/file/p32440187/balls_in_numbered_boxes.py
balls_in_numbered_boxes.py 
-- 
View this message in context: http://old.nabble.com/recursive-algorithm-for-balls-in-numbered-boxes-tp32440187p32440187.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

recursive algorithm for balls in numbered boxes "Dr. Phillip M. Feldman" <Phillip.M.Feldman@gmail.com> - 2011-09-10 17:43 -0700
  Re: recursive algorithm for balls in numbered boxes Mark Dickinson <mdickinson@enthought.com> - 2011-09-11 08:08 -0700
    Re: recursive algorithm for balls in numbered boxes "Dr. Phillip M. Feldman" <Phillip.M.Feldman@gmail.com> - 2011-09-12 08:47 -0700

csiph-web