mpl: re-work utilization handling #8665
Draft
+210
−304
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
When we're placing clusters, we generate multiple annealing runs in order to attempt convergence. For each new run, we decrease the amount of dead space i.e., increase the utilization by 5% so that it becomes easier to fit the rectangles in the outline.
Currently there are two controls that handle how utilization varies across runs:
The rationale is cited in a comment in the code:
However, after quite some testing, it looks like the convergence problems MPL had were mainly due to different problems such as the shaping engine or the annealing engine not working due to bugs.
Changes
*The fine shaping function was doing many things at the same time. So I broke it into 3 separate pieces, each one of them takes care of a single thing:
discardValidTilingsgets rid of the tilings that don't fit in the outline.validUtilizationis to check if the current utilization value generates a total soft area that surpasses the available area for inflation.applyUtilizationis the function that actually inflates the objects.