SchweizerischeBundesbahnen / netzgrafik-editor-frontend

The Netzgrafik-Editor is a powerful software that enables the creation, modification, and analysis of regular-interval timetable.
https://schweizerischebundesbahnen.github.io/netzgrafik-editor-frontend/
Other
33 stars 11 forks source link

[META] Origin/destination analysis layer/Information extractor #126

Open aiAdrian opened 6 months ago

aiAdrian commented 6 months ago

Preflight Checklist

Request type

Request for a new component

Functionality

The Origin/Destination Analysis enables the analysis of travel times and connections in the network graph (timetable). In principle, the fastest connections are sought starting from a start node. In order to limit or penalize the number of transfers, the timetable planner has the option to penalize transfer connections with additional time. This allows the costs for transfers to be controlled and determines whether a travel chain may include more or fewer transfer operations. The feature should implement the following functions/requirements:

Embedded in a dialog

The origin/destination matrix is opened in a dialog window, similar to the trainrun dialog. The dialog box is centered in the window and can be toggled to full screen if requested by the user. Toggling the full screen mode off will reset it to the initial size. The dialog window can be freely moved. The dialog window can be closed, by clicking in the upper right corner. In the menu bar there will be a button to open/close the dialog window. The origin/destination matrix should be possible to open in the editor and in the Streckengrafik (time distance graph).

Design - proposals (TBD) for the matrix:

Filtering

Connectivty

Interactivity

E.g. BN to ZF

Search

Cell: Enter from / to Node shortname - will reduce the matrix dimension. Either no node is specified (full matrix), or only from / to (filtered matrix) or both (just one path).

UI Prototype

Editor image

Streckengrafik image

(The times, ... in the example are not correct, just a Mockup.)

Real-time feedback Once a path is selected in the origin/destination matrix, editing of the Netzgrafik is locked, which means no changes can be made. If no path is selected, any changes made in the Netzgrafik will result in an update of the matrix. It might be necessary to calculate it in a separate thread to ensure high responsiveness, but this needs to be tested during implementation.

Changing the filter immediately triggers an update.

If a path was selected and changing the filter causes the path to disappear (no longer feasible), it will result in the deselection of the path. However, if the previously selected path remains visible after changing the filter, it will remain selected as it was. The same behavior applies if the user deletes a trainrun and the path is no longer found or feasible. In such cases, the path will be deselected.

Open questions The CVS export button is missing, and the position for the input field and button has not been fixed yet. The transfer penalty must also be insertable.

Which design variant is the most readable and best fit? It needs to be determined.

Dependancy

https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-frontend/issues/77

louisgreiner commented 5 months ago

Thank you Adrian for the document, we will soon have a closer look at this feature and see how we can work from it !

aiAdrian commented 4 months ago

This comment can provide inspiration.

image

Please take a look at the feature (Analytics enabled / not yet well implemented) where the current version calculates the shortest path and uses the current network graphic for visualization.


image


image

The concept behind this online real-time analytics is to calculate the travel times from a specific node of interest to all other nodes in real-time. When the mouse pointer hovers over the "clock," the corresponding sector representing a 1-minute interval gets highlighted. If the user clicks on a sector, all paths are visualized. The visualized paths represent the shortest path taken to "implement" the travel chain, with the departure time at the node of interest set to the selected minute. Only the colors in the nodes are important, so the clocks are visualized with near-transparent opacity. If no sector/minute is selected, the colors in the nodes and the paths are not relevant, meaning the user can manipulate the network graphic normally, and the clocks will always adjust accordingly.

The business information behind this concept is that there is a passenger or goods ready to be transported at a specific node at a given time. Thus, the displayed travel chain (travel time) is the effective travel time for a passenger. The clock for #changes (Umsteigen) and #travel time (Reisezeit) gives a very quick overview of how well the concept is balanced.

Required interactions:

aiAdrian commented 4 months ago

Discussion: Meeting 03.07.2024

Commitment We agree that the Origin-Destination Matrix should be developed in small steps. We agree that it is currently very difficult to estimate how quickly the matrix can be calculated. Since each entry is a shortest path and the necessary information needs to be extracted for each of these paths, the computation time can potentially be very long. To get a sense of how quickly the many Dijkstra shortest paths can be calculated, we want to first develop or test the matrix as a pure CSV (comma-separated value) export.

Here's what we will do:

Ajdustment / Next steps

louisgreiner commented 4 months ago

Thank you for the debriefing, we indeed agree on your above comment.

First, we will search for an algorithm (if there is!) that enable the computation of some nodes to some nodes only, to allow taking in account the filtering, otherwise we might stick to Dijkstra. We thought on a way to reduce computational complexity : re-use the calculations on sections already computed.

We still have a few questions:

[!NOTE]
For implementation: do not forget to take in account the minimal connection time (of a node) when trying to compute shortest path

aiAdrian commented 4 months ago

Test Scenario: The data and all lines are fictional, but having a medium-sized test network graphic is valuable:

Medium Test_Scenario.json

Small Test_Scenario_2.json

Small Test_Scenario_3.json

louisgreiner commented 4 months ago

Technical workshop debrief (22/07/24)

Participants: Adrian, Jules, Louis, Maëlys, Stéphane

Optimization problem formulation

Constraints

Objective function

Output for the optimal path of a pair

Algorithms to test

To be done

shenriotpro commented 4 months ago

About the algos: just wanted to mention Floyd–Warshall is an option in theory, but it may be too slow for many vertices (1000+, sparse graph).

shenriotpro commented 4 months ago

For the graph model: each "inner" vertex will likely be a (node, "arrival" or "departure", time) tuple, each edge being derived from trainrun sections (departure, arrival) or connections/transitions (arrival, departure), including connection cost if suitable. The algos may run more easily if we generate a departure and arrival "outer" vertex as well for each node (the expected output being shortest paths from departure to arrival outer vertices), connected to the "inner" vertices at this node (likely costing 0). Memory may or may not be an issue, it may help to implicitly generate the graph (mostly if running dijkstra).

louisgreiner commented 3 months ago

Proof of concept

Author: @shenriotpro

Link : https://colab.research.google.com/drive/1Omx_qt2fnW1kJC6kQrhOgdkTZzmtibid?usp=sharing#scrollTo=EDXs4tO0kmDr

POC with input Scenario medium

Limitations of the POC (see TODO in code):

To do

A filter has been implemented to select the nodes that we want for the output (but still search in all nodes)

Implementation

Ticket that describes:

shenriotpro commented 3 months ago

A few notes:

shenriotpro commented 3 months ago

Fixed a few bugs, there are a few ways to optimize, but the performance got worse:

louisgreiner commented 1 month ago

I am trying to write down the feature for the User Interface part

I have several questions:

shenriotpro commented 1 month ago
  • "in the Streckengrafik, the used path is highlighted" (cf. above picture, path is in green/red), any more informations ?

Note that the used path is currently not computed (it should not be too hard though).

  • considering the above comments, a lot of features needs to dynamically change the matrix, if opened ; do we still consider running O/D matrix calculations on any change ? which might slow the application

This is outside my expertise, but it could possibly be updated on a regular basis (when the user is inactive?) or on a separate worker.

aiAdrian commented 3 weeks ago

https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-frontend/issues/199

Early experiment: Done with Version 2.9.1

image