Bugs in new ShipScheduling algorithm

Bug #1827033 reported by Klaus Halfmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
High
Benedikt Straub

Bug Description

Load the attached savegame (bases on the Imperial Sceanrio) and wait a few seconds.

...
 WidelandsMapLoader::load_map_complete() for 'Neptune’s Revenge' took 3182ms
...
[sync] Reset
ComputerPlayer(2): initializing as type 2
    ... DNA initialized
  2: 0 basic buildings in savegame file.
 2: expedition max duration = 5006 (83 minutes), map area root: 104
Assertion failed: (get_path(start, finish, path_start_to_finish)), function is_path_favourable, file ../src/economy/fleet.cc, line 764.
Abort trap: 6

This was just after I conquered the Babarian HQ I think.

This is bzr9088[trunk] compiled with ASAN, LLVM on OSX.

Tags: seafaring

Related branches

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :
Revision history for this message
Benedikt Straub (nordfriese) wrote :

The function in which the assert fail happens was introduced by the new ship scheduling algorithm…

Changed in widelands:
importance: Undecided → High
status: New → Confirmed
tags: added: seafaring
Changed in widelands:
assignee: nobody → Benedikt Straub (nordfriese)
status: Confirmed → In Progress
Revision history for this message
kaputtnik (franku) wrote :

I got this assert also with bzr9094 when loading the attached savegame and the second ship arrives at the port.

The reason why i have made this savegame was: Before saving i noticed:

1. the first ship arrives at the port
2. loaded soldiers and stones
3. navigated to the close port on the west
4. removed all wares and soldiers
5. loaded the wares and soldiers again
6. navigated to the third port (also in the west but far away)

I have set the priority of soldiers on the third port, so i was surprised why the ship stops at at the second port un/reloading the wares and soldiers. I thought this is a bug and created this savegame, which shows the assert now.

I did not understand why the ship scheduling branch was merged anyway... it hasn't a bug associated and wasn't tested imho. Hopefully this is not part of build20.

Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
kaputtnik (franku) wrote :

The backtrace of the assert

Revision history for this message
kaputtnik (franku) wrote :

If you are interested in the odd behavior ships navigating to a port unloading wares and immediately load the same wares again, here is the replay. Increase gametime until you are at 2hrs and 29 minutes, scroll the map to the position where you can see two ports and wait until the ships start bringing wares to the unseen port.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

I accepted this bug now because I´m also getting it in a savegame now ;) My backtrace is identical to yours, so it seems this happens quite often.

The new shipping algorithm workflow seems really strange to me: As far as I can see, the general idea is that a ship will unload wares/workers if its next destination is far out of the way, and it will pick up items where the next destination either the item´s destination or if the destination is "favourable" regarding the item´s actual destination, whatever that means...
Lots of times, a ShippingItem (that´s a wrapper for a WareInstance) will have no destination set (why?) but the Ware it contains has a portdock as its next destination (how???), in which case the ware is unloaded and promptly re-added (as I described in the merge request).

The author of the new algorithm left a TODO that the existence of ShippingItems without a destination should be prevented, and that´s where a true fix would need to start. I don´t know that code nearly well enough to do that though :(

Fortunately this is not in build 20. I feel safe to compare our great new ship-scheduling with our great new anti-congestion algorithm in some regards...

summary: - Neptuns Revenge: Assert is_path_favourable,fleet.cc,764. bzr9088
+ ShipScheduling algorithm: Assert is_path_favourable,fleet.cc,764
Revision history for this message
GunChleoc (gunchleoc) wrote : Re: ShipScheduling algorithm: Assert is_path_favourable,fleet.cc,764

I have triggered the merge. I might look into this for Build 21 or not - we can always rip it out if not.

summary: - ShipScheduling algorithm: Assert is_path_favourable,fleet.cc,764
+ Bug sin new ShipScheduling algorithm
summary: - Bug sin new ShipScheduling algorithm
+ Bugs in new ShipScheduling algorithm
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have now attached the original branch to this bug for easier bookkeeping.

To be fair, the anti-congestion algorithm seems to have been working and our transport bug is caused by something else. The savehandling control flow changed when we fixed the handling of economy IDs, so the bug is probably there somewhere, but I had to rip out the other algorithm anyway so that we could exclude it as a possible culprit.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

By the way, I just discovered that the destination portdock of a ShippingItem is not set when loading. This may explain the invalid destinations and consequent bugs. I´m fixing this in the attached redesigning branch.

Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.