From fda7054840fc7bc590e2433b8208871aa71d90d4 Mon Sep 17 00:00:00 2001 From: Gabriel Gouvine Date: Thu, 29 Jun 2023 15:11:00 +0200 Subject: [PATCH] Apply density variation on the whole placement area, avoiding reduced free space under huge bloat --- etesian/src/EtesianEngine.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/etesian/src/EtesianEngine.cpp b/etesian/src/EtesianEngine.cpp index cbc66f07..7149cec4 100644 --- a/etesian/src/EtesianEngine.cpp +++ b/etesian/src/EtesianEngine.cpp @@ -845,9 +845,8 @@ namespace Etesian { } // Compute the space margin from the row length computed earlier - double spaceMargin = (double) (totalLength - usedLength) / usedLength; - double densityVariation = getDensityVariation(); - double bloatFactor = 1.0 + std::max(spaceMargin - densityVariation, 0.0); + double spaceFactor = (1.0 - getDensityVariation()) * totalLength / usedLength; + double bloatFactor = std::max(1.0, spaceFactor); if (bloatFactor != 1.0) { ostringstream bf; bf << fixed << setprecision(2) << bloatFactor << "%";