J.Pietschmann wrote:

>    3. Distribute any slack space left equally on the resizable spaces
>       (subject to round off, should use a Bresenham-like algo for
>       perfection :-)
>    Can anybody come up with an algorithm to distribute slack space
>    over several leaders which can deal with arbitrary combinations
>    of opt-max intervals?

Unless the spec indicates something different, my naive solution would be to
distribute it in proportion to their pre-existing (optimal) size. So with 3
leaders, A, B, & C:
  new sizeA = sizeA + (sizeA / (sizeA + sizeB + sizeC) * slack)

Compute the above for each leader, limiting each to the max. If any max out,
they are completed, and the excess returns to the pool. Repeat this for
remaining leaders until excess is used up or all of them max out. Don't
apply your rounding until the end. If all of them max out, it would seem
reasonable to distribute any remaining slack equally as space between the
leaders.

Victor Mote


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to