Latest Posts

Topic: Solution proposals for maritime shipping problems

Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-02-05, 20:13

Had a quick look at the code. When the economy doesn't have enough tools it creates request in warehouses for these tools. The tools are then brought to the requesting warehouses. Warehouses are iterated in order of their creation, this should be fixed.

(Code is in Economy::create_requested_worker, lines 842 and 887 need replacing with a vector of warehouses sorted by distance to the site that needs a worker)

Edit: This is not trivial, because the economy batch-creates as many workers of a type as needed and possible

Edited: 2020-02-05, 20:15

Top Quote
JanO
Avatar
Joined: 2015-08-02, 11:56
Posts: 177
Ranking
At home in WL-forums
Posted at: 2020-02-05, 23:34

Question (king):
You have two colonies, connected only overseas, right? An old one with HQ + port and a newer one with toolsmith + port? You have set the warehouses in the old colony to zero storage for tools both, allowing tools only in the port near the toolsmith.
Did you have a look into the economy demans window? Can you set independent values for both colonies and if so, can you solve the problem by that?


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 2646
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2020-02-06, 10:36

JanO wrote:

Question (king):
You have two colonies, connected only overseas, right? An old one with HQ + port and a newer one with toolsmith + port? You have set the warehouses in the old colony to zero storage for tools both, allowing tools only in the port near the toolsmith.
Did you have a look into the economy demans window? Can you set independent values for both colonies and if so, can you solve the problem by that?

If this would be possible I would rate it as a bug as Colonies connected by ports should be in the same economy.


Top Quote
JanO
Avatar
Joined: 2015-08-02, 11:56
Posts: 177
Ranking
At home in WL-forums
Posted at: 2020-02-06, 12:43

That's why I ask. I know that once I could set the demands on different islands individually, but I don't remember if I had ships there (should so, otherwise I would not have had settlements on different islands). But that was probably b18 or something.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2020-02-21, 20:06

Solstice_s_Return wrote:

(Is there ships inventory implemented in build 20? As I still use b19 and have been missing such a feature.)

Yes, there is: https://www.widelands.org/news/2019/May/4/widelands-build-20-released/

Seafaring statistics


Busy indexing nil values

Top Quote
king_of_nowhere
Avatar
Joined: 2014-09-15, 18:35
Posts: 1668
Ranking
One Elder of Players
Posted at: 2020-02-22, 00:47

JanO wrote:

Question (king):
You have two colonies, connected only overseas, right? An old one with HQ + port and a newer one with toolsmith + port? You have set the warehouses in the old colony to zero storage for tools both, allowing tools only in the port near the toolsmith.
Did you have a look into the economy demans window? Can you set independent values for both colonies and if so, can you solve the problem by that?

damnit! i was sure i had answered to this, but now i see i didn't. sorry for taking too long.

y, the colonies are like you describe. and yes, now that i know that a requested worker generates a request for the tool in the oldest warehouse, i know i could have fixed it by increasing the demand from the stock. in that case, the tool would have been sent to the closer warehouse, and would have been used there to make the worker.


Top Quote
Solstice_s_Return
Avatar
Topic Opener
Joined: 2020-01-28, 13:24
Posts: 62
Ranking
Likes to be here
Location: Finland
Posted at: 2020-02-22, 10:55

GunChleoc wrote:

Solstice_s_Return wrote:

(Is there ships inventory implemented in build 20? As I still use b19 and have been missing such a feature.)

Yes, there is: https://www.widelands.org/news/2019/May/4/widelands-build-20-released/

Seafaring statistics

Yeah, I'm aware of this now as I ve played a bit with b20-1 too and recently took a quick look into 20-7 also.


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1929
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-04-23, 20:11

There' s a pull request up to refactor the shipping algorithm in a way that should fix all issues described here as well as a bunch of hangs, crashes, and asserts: https://github.com/widelands/widelands/pull/3857

There are still a few asserts left in this branch, but I'd appreciate testing and reporting of unexpected/undesired/suboptimal behaviour face-smile.png

For testers who like to experiment – you can try playing around with the weighting constants in src/economy/shipping_schedule.cc lines 44-64 (recompile after every change) to try to improve the algorithm's decisions if you notice some suboptimal decision making.

The logic of the algorithm is documented in the same file, lines 330-357 and subsequent comments ("1st-6th pass").
Basically it's almost the same approach, minus an exponential function, plus proper handling for port&ship removal and more intelligent distribution of ships (including distributing idle ships among ports), and everything centralised in one place and kept in machine memory for optimal (in theory) decision making.


Top Quote