in reply to Re^3: Help Me in following code ::
in thread Help Me in following code ::

Ok let me explain again
I have stated array above @A_services that value must be from that as well as Random number from rand function must not be zero
as well as no repeat random no.
Please go through with my post again and help me out
The range of Random Number is from 1-186 the number is only from range .And respected number having value is from Array @A_services
e.g.
Suppose first 6 number are 1,2,3,4,5,6 now
find its value from @A_services that is $A_servises1 that will be 121
now add all values from array and its addition must be in between 840 - 900
also that 6 number must not repeat any where .
Please Give a look again

Replies are listed 'Best First'.
Re^5: Help Me in following code ::
by BrowserUk (Patriarch) on Apr 13, 2010 at 14:56 UTC

    One last try.

    • You have an array that contains 186 numbers.
    • You wish to pick groups of 6 numbers, without duplicates, from that array, that sum to between 840 & 900.
    • And once a number has been picked, it must not be picked again.

      Neither within the same group. Nor in any other group.

    Does that cover it?

    Questions:

    • How many groups of 6 do you want to pick?
    • You also mentioned "4/5/6". Does that mean you'll also accept groups of 4 otr 5 numbers?
    • Are totals of 840 & 900 both valid?

    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.
      Yes now you got that ,
      Your Que. are also valid
      We can take group of 4 or 5 or 6 number
      and without duplicates and
      totals between 840 & 900
      And How many groups : till the all number comes in that

      and please go through the array i have mention
      @A_services
      pick data from that only
      its value having some duplicate entry thats ok
      But index of that Array value is unique
      , We want that in group of 4 or 5 or 6 till all the value from @A_services covers

      Thanks again

        Your problem is a variation upon the Bin packing problem.

        Unfortunately, your particular constraints--variable size bins & constrained number of items per bin--do not fit with either of the bin packing solutions on cpan: Algorithm::BinPack & Algorithm::Bucketize.

        I think now we have clarified what the problem is that you are trying to solve, it might be better to post a new top-level node--perhaps I should do that on your behalf to ensure it is clear--so that the other monks with more CS chops than I might take a second look at your problem.

        I have some thoughts on it and might post something here later.


        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.