Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Multiple Combinatorics

by JavaFan (Canon)
on Apr 15, 2012 at 15:06 UTC ( #965168=note: print w/replies, xml ) Need Help??

in reply to Multiple Combinatorics

My sets can overlap too. For exmaple I may have 4 sets like '0..7','1-6', '6-12',and '3..9'. I also need to eliminate duplicate items. In the case of overlapping sets, every resulting row should satisfy the initial condition. ie.. if I ask for 2 from '0..7' and 3 from '6..12', I should NOT have "6,7,6,7,8" or even "4,5,6,7,8" ( Here 0..7 has 4 entries rather than 2, as asked for.)
With those conditions, nothing will satisfy if you'd have to pick at least one from '1..6'. Because any pick from that set will be a possible pick from the set '0..7', making that the count of picks from that set will be off.

Replies are listed 'Best First'.
Re^2: Multiple Combinatorics
by aartist (Monk) on Apr 15, 2012 at 15:45 UTC
    If '0-7' has less number of picks compared to '1-6', then we will have no solution at all. But, it is possible that ('0-7','1-6') has (3,2) picks or even (2,2) picks respectively. In the first case there will be exactly 1 selection from 0 and 7 in any solution. In the 2nd case, 0 and 7 will not be selected in any solution.

      Care to clarify that? Maybe add some examples? Cos like JavaFan, I don't get it.

      As soon as you pick any two values from group 2 (1..6), you've also already picked two values from group 1 (0..7), so there is no way to comply with your "every resulting row should satisfy the initial condition" requirement.

      You would either a) a pick two from both groups and therefore have 4 from the larger group; or b) pick nothing from the larger group, in which case you have nothing from the larger group.

      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

        Yes: if Group B (1..6) is subset of Group A(0..7) and Pick(B)=2 is equal to Pick(A)=2 then we apply 'b): pick nothing from larger group';

        In this case, we still have picked 2 values from larger group automatically, which holds the initial condition. Only thing that '0' and '7' won't be picked at all in any resultset. ( from the given data).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://965168]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2018-05-25 06:25 GMT
Find Nodes?
    Voting Booth?