On Thursday 03 August 2006 16:47, Apache Wiki wrote:
> Dear Wiki user,
>
...
Hi Jeremias,

just saw your improved keeps wiki and am wondering if an algorithm along 
the following lines may do the trick to deal sensibly with different 
keep strength values in the context of the Knuth breaking algorithm:

1. For each keep related Knuth penalty we create we remember in the 
Knuth element the specified integer keep value (if any)

2. As is now all those penalties are initially set to INFINTE

3. If the breaker can't find a set of break opportunities we adjust the 
penalty value for all keep related penalties with the smallest value 
keep value down from INFINITE

4. Run the breaker again

5. If no luck take the INFINTE penalties with the next lowest specified 
keep value and adjust them down

6. Repeat 4. and 5. until break opportunities are found or nothing is 
left that can be adjusted

Assuming that this is rarely needed in practice at lest not many 
iterations just scanning a linked list in these circumstances and 
running the breaker again should not be a real performance problem.

Manuel

Reply via email to