Topic: ware routing tweak
Tibor Topic Opener |
Posted at:
2020-02-01, 19:17 UTC+1.0
Hi, based on the current discussion in other forum I looked into code and came up with one trivial tweak: https://github.com/widelands/widelands/compare/ware_routing_tweak Basically it changes the formula how transporation cost THIS_FLAG -> NEIGHBOUR_FLAG is calculated. Now it just sums count of wares on both flags. My tweak considers:
I did some test with AI but nothing interesting to see. So I offer this for testing and feedback Just two notes:
And one developer note - old formula was 'bi-directional', this one is not, I have no idea if it matters somewhere in the code... EDIT: It is not possible to update the title, is it?
Edited:
2020-02-01, 20:46 UTC+1.0
![]() ![]() |
JanO![]() |
Posted at:
2020-02-02, 22:39 UTC+1.0
You mean "a" instead of "e"? Don't bother
Edited:
2020-02-02, 22:39 UTC+1.0
![]() ![]() |
Tibor Topic Opener |
Posted at:
2020-02-03, 08:20 UTC+1.0
The number of carriers is good comment, I will look into code if it is possible to get this number easily. The score is now calculated as:
![]() ![]() |
hessenfarmer![]() |
Posted at:
2020-02-03, 09:00 UTC+1.0
old formula was (wares_on_this_flag + wares_on_next_flag) / 2 so the new formula just starts to increase the penalty if there are more then 5 wares on the next flag and traffic is monodirectional. It decreases penalty if traffic is bidirectional. ![]() ![]() |
Tibor Topic Opener |
Posted at:
2020-02-03, 09:21 UTC+1.0
We dont care about the traffic in opposite direction at all.... it does not affect the time for transfer in "our" direction ![]() ![]() |
hessenfarmer![]() |
Posted at:
2020-02-03, 10:15 UTC+1.0
And that is why your new formula is better then the old one I believe, as it takes direction into account. ![]() ![]() |
Tibor Topic Opener |
Posted at:
2020-02-03, 13:07 UTC+1.0
There are two considerations:
![]() ![]() |
JanO![]() |
Posted at:
2020-02-03, 18:37 UTC+1.0
I think the pingpong would be possible, but how bad would that be? For the ware it would not matter, maybe it's bad for CPU. But what is worse, a ware in pingpong mode, unnecessarily triggering the pathfinding algorithm or an additional check in the concestion-rerouting-code... ![]() ![]() |
hessenfarmer![]() |
Posted at:
2020-02-03, 19:02 UTC+1.0
theoretically possible in a triangle situation with exactly the same cost on each path. but as costs are changing constantly I believe this would clear after max. 2 toggles. So I would not bother at all until shown otherwise. ![]() ![]() |