Author Topic: Patch to get closer to a break  (Read 3143 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Patch to get closer to a break
« on: January 01, 2014, 11:23:27 PM »
Attached is a patch for revision 7002 to get closer to a break in a route. However, the heuristics of close are such that this fails way too often. Hence I did not commit it.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4224
  • Total likes: 168
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Patch to get closer to a break
« Reply #1 on: January 02, 2014, 08:50:54 AM »
Your routine searches the position that is as closest to the target as possible. Another possibility would be to treat all non-passable tiles as passable but with absurdly high weight. The weights could depend on the reason why no passage is possible (no electrification, wrong signal direction, ways not connected, no ways at all etc)
Parsley, sage, rosemary, and maggikraut.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4681
  • Total likes: 170
  • Helpful: 108
  • Languages: EN, NO
Re: Patch to get closer to a break
« Reply #2 on: January 02, 2014, 05:19:29 PM »
Your routine searches the position that is as closest to the target as possible. Another possibility would be to treat all non-passable tiles as passable but with absurdly high weight. The weights could depend on the reason why no passage is possible (no electrification, wrong signal direction, ways not connected, no ways at all etc)

Sounds like possibly a good idea, except maybe for when there are no ways at all. I would assume that most issues with breaks is simply from one tile to the next, so if the initial (current) way finder fails, then do another one that ignores signs/signals, electrification and to some extent ribis, but marks the tiles when it did this and use a higher cost. Once a route is found with these relaxed constrains, the marked tiles in it will be the likely problem points. If the marking also includes the type of cheat required, it will also help the player figure out what must be corrected.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Patch to get closer to a break
« Reply #3 on: January 02, 2014, 10:16:55 PM »
I think the idea with high weights for non-existing tiles is a good one. I am just worrying that this may take quite a while (i.e. the whole map) when an unconnected tunnel comes into play ...

EDIT: I hope the attached patch works better.
« Last Edit: January 02, 2014, 11:23:40 PM by prissi »

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4681
  • Total likes: 170
  • Helpful: 108
  • Languages: EN, NO
Re: Patch to get closer to a break
« Reply #4 on: January 03, 2014, 06:02:36 AM »
It is possible that the weight doesn't need to be very high if one already knows that there is no functioning path, although the weight may have to be tuned based on how likely the type of break is. Two bridges meeting end-to-end, bridge meeting tunnel, or even bridge meeting some platforms, without being connected seems like something that can be given a low weight.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Patch to get closer to a break
« Reply #5 on: January 03, 2014, 06:18:44 PM »
I was thinking to integrate this into the regular way search, i.e. return the tile for non-existing connections. For this the weight needs to be very height to find any existing connection first.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4681
  • Total likes: 170
  • Helpful: 108
  • Languages: EN, NO
Re: Patch to get closer to a break
« Reply #6 on: January 03, 2014, 11:23:07 PM »
find_way_break2.patch isn't gcc friendly with what it does on route.h line 82. gcc doesn't like the part up to and including the first pair of colons.

Is this patch supposed to actually inform of which break position it found?
« Last Edit: January 03, 2014, 11:28:56 PM by Ters »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4224
  • Total likes: 168
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Patch to get closer to a break
« Reply #7 on: January 04, 2014, 07:52:44 AM »
I was thinking to integrate this into the regular way search, i.e. return the tile for non-existing connections. For this the weight needs to be very height to find any existing connection first.
Imho this addition should only be used when the user requests it. Otherwise there is always the risk of performance hits and false negative reports.
Parsley, sage, rosemary, and maggikraut.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4681
  • Total likes: 170
  • Helpful: 108
  • Languages: EN, NO
Re: Patch to get closer to a break
« Reply #8 on: January 04, 2014, 11:34:57 AM »
Is this patch supposed to actually inform of which break position it found?

I now see that it doesn't work if the first leg out of the depot is broken. If I put a waypoint between the depot and the break, I get a message with some coordinates. The coordinates are nowhere near the break, though. I get the last and second to last coordinate of the intended path, while the break is at the ninth last coordinate.

UPDATE:
Seems like signals facing the wrong way don't trigger extra cost. It might be this that causes the observed behaviour.
« Last Edit: January 05, 2014, 11:26:43 AM by Ters »