How about the following,

No. of apples = N
No. of baskets = M
Capacity of baskets = [C1, C2, ...., Cm]

P = capacity utilization = N/(C1 + C2 + ... + Cm)

Apples in i'th basket = Ci*P

Of course (Ci*P) need not be integeral. Perhaps we can try rounding it to 
nearest integer and see if their some equals N. If not, start trying different 
combinations, but try to be as close to Ci*P as possible.


 

________________________________
From: Sandeep .A.S. <reachtosand...@gmail.com>
To: algogeeks@googlegroups.com
Sent: Wednesday, 9 September, 2009 4:52:13 PM
Subject: [algogeeks] Re: N number apples needs to distribute across M num 
baskets of varying capacity in balanced way


Hello Bharath,

Thanks for your suggestion.

I want to distribute the apple across all the basket balanced way.
In other words
“I want to calculate the optimal number of apples on each basket  such
a  way that free and used space on each basket  equal to total
percentage of free and used space on all the baskets “

Thanks & Regards,
Sandeep


On 9/9/09, Bharath Kumar <bharath1...@gmail.com> wrote:
> What does optimal balance mean?
>
> In your example case, if you have 10 apples,
>
> put 2 in basket1, 4 in basket2, 4 in basket3 and basket4 gets nothing.
>
> If you have to make sure that, each basket gets at least one apple, then
> start distributing apples one by one to each basket until it reaches its max
> capacity.
>
> But approach may differ upon the definition of optimality.
>
>
>
> On Wed, Sep 9, 2009 at 11:54 AM, Sandeep .A.S. <reachtosand...@gmail.com>
> wrote:
> >
> > Hi,
> >
> > Please let me know is there any standard algorithm to solve the below
> > mentioned problem.
> >
> > Problem statement:
> >
> > I am having 10 apples and 4 basket each basket capacity is as mentioned
> below:
> >
> > Basket1 : capacity can hold  maximum of 2 apples
> > Basket2 : capacity can hold maximum  of 4 apples
> > Basket3 : capacity can hold maximum  of 6 apples
> > Basket4 : capacity can hold maximum  of 8 apples
> >
> > I want to distribute the apples based on percentage contribution of
> > each basket to total number of apples can accommodate by all the
> > basket
> >
> > For the above example the 10 apples can be distributed as follows:
> >
> > 1 apple for basket1 (10% => (<basket1 capacity>/< total of all basket
> > capacity>) *100 => (2/20) *100)
> > 2 apple for basket1(20% =>(<basket2 capacity>/< total of all basket
> > capacity>) *100 => (4/20) *100)
> > 3 apples for basket 3(30% => (<basket3 capacity>/< total of all basket
> > capacity>) *100 => (6/20) *100)
> > 4 apples for basket 4(40% => (<basket4 capacity>/< total of all basket
> > capacity>) *100 => (8/20) *100)
> >
> > In the above example what if I have 13 apples?  What is the best
> > approach to solution which is near to optimal balance?
> >
> > I request you to provide the idea to resolve this problem.
> >
> > Thanks &  Regards,
> > Sandeep
> >
> >
> >
>
>
>
> --
> <<Bharath>>
>
>
> >
>



      See the Web&#39;s breaking stories, chosen by people like you. Check out 
Yahoo! Buzz. http://in.buzz.yahoo.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to