WindmillHelix / Brickficiency2

https://www.reddit.com/r/brickficiency
33 stars 14 forks source link

Only two decimal digits from part price used, may lead to rounding error and sub-optimal result #17

Open bernhardkohlhaas opened 7 years ago

bernhardkohlhaas commented 7 years ago

I'm using Brickficiency 2.01a and I noticed that BrickLink actually found a better solution than Brickficiency, even when the latter computed all combinations. The reason is that Brickficiency only uses 2 decimal digits for the part price, whereas BrickLink uses at least 3. After multiplying that price with the part quantity BrickLink then rounds the lot subtotal to 2 decimal digits.

So if a part costs $ 0.016 and you order 1000, BrickLink will compute the lot subtotal to $16, whereas Brickficiency will compute it to $20. (And FWIW the rounding appears to goe the other way, too.)

Here is the example, where BrickLink finds a better result: price comparison

Here is one position from the Brickficiency result file: bf report result

And the same position in the BrickLink shopping cart: bl shopping cart

Of course the error is small, in my case less than a percent of the amount, but could be a few percent in some cases. Still every penny counts, so it would be nice, if Brickficiency could use the same number of digits for the part price as BrickLink.