Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Partitioning a set into parts of given sizes

by blokhead (Monsignor)
on Nov 21, 2006 at 15:07 UTC ( #585276=note: print w/replies, xml ) Need Help??


in reply to Re: Partitioning a set into parts of given sizes
in thread Partitioning a set into parts of given sizes

First, why do you require that the block sizes add up to the total number of items?
Otherwise what you get is not a partition according to most definitions. You can somewhat get around this by partitioning into groups and letting one group be a "trash" group that is not output. But for that you must have one distinguished group (as in ordered partition) and the rest undifferentiated (as in unordered partition), so it would be trickier.

Now that I'm thinking about it a little more, though, it may be possible to adadpt how it generates RG-sequences internally to support just that by allowing the value "0" to signify "not included in output," where every item (including the first) can take on value 0. I wouldn't be able to code it up for a while, but it seems do-able.

blokhead

  • Comment on Re^2: Partitioning a set into parts of given sizes

Replies are listed 'Best First'.
Re^3: Partitioning a set into parts of given sizes
by Limbic~Region (Chancellor) on Nov 21, 2006 at 18:45 UTC
    blokhead,
    I looked at the problem a bit differently. I have a group of N items that I need to group into sets of a smaller size and then partition each set. I think this is a useful enough feature to include it - I am just not sure they way I implemented it is optimal. What are your thoughts on collaborating on CPAN module(s)?

    Cheers - L~R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://585276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-10-03 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (15 votes). Check out past polls.

    Notices?