pyfa-org / Pyfa

Python fitting assistant, cross-platform fitting tool for EVE Online
GNU General Public License v3.0
1.6k stars 406 forks source link

This fit, fits in game but not in pyfa. #1962

Open Neugeniko opened 5 years ago

Neugeniko commented 5 years ago

This uses 87.52/87.5 pg(doesn't fit) in pyfa but in game appears to use 87.48/87.5 pg(fits). It appears each modules pg is rounded to 2 decimal places in game before being added up to achieve this.

[Thrasher, Gank ART - Neug Kin]

Gyrostabilizer II Gyrostabilizer II

1MN Y-S8 Compact Afterburner Small Shield Booster II Upgraded Kinetic Deflection Amplifier I

280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S 280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S 280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S 280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S 280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S 280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S 280mm Howitzer Artillery II, Republic Fleet Titanium Sabot S [Empty High slot]

Small Core Defense Capacitor Safeguard I Small Projectile Burst Aerator II Small Anti-Thermal Screen Reinforcer I

Republic Fleet EMP S x3000

DarkFenX commented 5 years ago

I thought I've implemented similar logic in cbd1a34c685d55b01646e33ac541d020195b252a, but probably it doesn't apply in all cases. I will take a look at it later.

DarkFenX commented 5 years ago

Not defending my code (yet), but for guns 11×0.9×1.05 = 10.395. Strictly speaking, according to CCP's logic it should be rounded up to 10.4 pg. But this one is quite peculiar value: depending on accumulated float errors (which depends on order of operations) it might go either way, roughly speaking 10.394444444444444444449 turns into 10.39, and all values starting from 10.395 and higher should result in 10.4.

Are you confident that this fit consistently fits in EVE? Maybe there're some occasions when it doesn't? Can you try to unfit some guns and fit again, or try another ship and see if result is consistently the same?

ps Not defending my code because it seems to take unrounded value - 9+3+0.75+1+1+10.395000000000001×7 which is rounded up to 87.2 in the end. But if I implement this code properly we will end up with 9+3+0.75+1+1+10.4×7 which is 87.55, which is even worse.

DarkFenX commented 5 years ago

I fixed the change i linked earlier in 7b8d9f8dbe0a1064ceb91bc9a84d2587154a5e71, now attributes are rounded properly (and yes i checked that this time). Powergrid consumption of linked fit is 87.55, as I expected.

Fixing it properly needs some serious research on how EVE handles operations and why EVE accumulates float errors this way, and pyfa accumulates the other way around.

I think we cannot 100% reliably know how EVE works with all these numbers. However, we can write specific logic so that if round(n, 9) == x.xx5, then number is rounded down. The question is - if we do that, will there be any fits which fit in pyfa but do not fit in game?

Most research should be concentrated on finding such combinations of modules/rigs/implants when item's cpu/pg equals x.xx5 then.

DarkFenX commented 5 years ago

I will put here examples I find:

DarkFenX commented 5 years ago

Results of some tests.

what decimal formula decimal result eve result python result
280mm arty pg 11×0.9×1.05 10.395 d10.39 d10.39
Polarized heavy pulse pg with 1 weapon rig 189×0.9×1.05 178.605 d178.6 d178.6
DG 250mm rail pg with 1 weapon rig 179×0.9×1.05 169.155 u169.16 u169.16
Retribution PG with 1% imp 62×1.25×1.01 78.275 u78.28 u78.28
Retribution PG with 3% imp 62×1.25×1.03 79.825 u79.83 u79.83
Retribution PG with 5% imp 62×1.25×1.05 81.375 u81.38 u81.38
Cruor CPU with 1% imp 150×1.25×1.01 189.375 u189.38 u189.38
Cruor CPU with 3% imp 150×1.25×1.03 193.125 u193.13 d193.12
Cruor CPU with 5% imp 150×1.25×1.05 196.875 u196.88 u196.88
Succubus PG with t1 acr with 1% imp 44×1.25×1.1×1.01 61.105 u61.11 d61.1
Celestis PG with 2% imp 575×1.25×1.02 733.125 d733.12 d733.12
Celestis PG with 6% imp 575×1.25×1.06 761.875 u761.88 u761.88
Celestis CPU with 2% imp 375×1.25×1.02 478.125 d478.12 d478.12
Celestis CPU with 6% imp 375×1.25×1.06 496.875 u496.88 u496.88

Python result is round(n, 2) of decimal result, d means rounding down, u means rounding up. It is clear that in both areas final result is dictated by float error. We might try following approaches:

1) Try to reverse-engineer how EVE processes calculations and implement the same way. It's huge :effort:, alot of testing and many restrictions applied to how pyfa handles calculations 2) Implement decimal-alike logic. I.e. in all cases mentioned above we will round up. It will not fix original issue though. 3) Do nothing and leave as-is. EVE has its own float errors, we have our own.

DarkFenX commented 5 years ago

So, in case of arty. List of involved items:

rig_skill_effect = skill_rig_drawback_bonus 5.0 adjusted_drawback = rig_drawback (1 + rig_skill_effect / 100) awu_skill_effect = awu_bonus * 5.0

result = pg (1 + awu_skill_effect / 100.0) (1 + adjusted_drawback / 100)

print(result)


results in `10.395000000000001`

No idea how to change it so that result matches ingame.
DarkFenX commented 5 years ago

Some extra info:

DarkFenX commented 5 years ago

For logging: a while ago I've filled EVE issue EBR-175339 which concerns inconsistent attribute rounding. Heard no feedback on it so far.