Jonathan G Rennison
55473bc730
Linkgraph: Split demand annotations from edge flow annotations
...
Use sparse storage format for demand annotations
2023-01-05 02:48:07 +00:00
Jonathan G Rennison
ad815210ae
Linkgraph: Dynamically adjust accuracy parameters in MCF 1st pass
...
For larger graphs (>= 50 nodes), reduce the accuracy and set a
minimum push flow threshold.
This avoids wasting a lot of time calculating very small flow demand
increments when the total number of demands is high and most demands
are small already.
2022-12-07 02:24:17 +00:00
Jonathan G Rennison
e647075870
Change LinkGraph::EdgeMatrix to a sparse storage format
...
Use a btree_map instead of a SmallMatrix.
This avoids excessive storage requirements for large graphs,
and overly expensive edge matrix resize operations.
Remove next_edge iteration mechanism.
2022-12-05 18:17:25 +00:00
Jonathan G Rennison
b14e213bd9
Add average travel time to the link graph overlay tooltip
2022-11-06 21:55:14 +00:00
Nicolas Chappe
a43a1902bb
Feature: [Linkgraph] Prioritize faster routes for passengers, mail and express cargo
...
Passengers usually prefer fast paths to short paths.
Average travel times of links are updated in real-time for use in Dijkstra's algorithm,
and newer travel times weigh more, just like capacities.
(cherry picked from commit 977604ef08
)
2022-11-05 19:07:35 +00:00
Jonathan G Rennison
29cd07d1c0
Fix aircraft link scale when loading previous savegame versions
...
See: #367
2022-02-04 18:30:22 +00:00
Jonathan G Rennison
89181ea9fd
Add setting to increase cost/distance of aircraft linkgraph links
2022-01-02 01:15:54 +00:00
Jonathan G Rennison
fd605e3cf3
Merge branch 'master' into jgrpp-beta
...
# Conflicts:
# .github/workflows/commit-checker.yml
# src/company_cmd.cpp
# src/console_cmds.cpp
# src/crashlog.cpp
# src/lang/english.txt
# src/lang/german.txt
# src/lang/indonesian.txt
# src/lang/japanese.txt
# src/lang/korean.txt
# src/lang/swedish.txt
# src/linkgraph/linkgraphjob.cpp
# src/linkgraph/mcf.cpp
# src/network/core/tcp.cpp
# src/network/core/tcp.h
# src/network/core/tcp_game.h
# src/network/core/udp.h
# src/network/network.cpp
# src/network/network_admin.cpp
# src/network/network_admin.h
# src/network/network_chat_gui.cpp
# src/network/network_client.cpp
# src/network/network_client.h
# src/network/network_func.h
# src/network/network_internal.h
# src/network/network_server.cpp
# src/network/network_server.h
# src/newgrf.cpp
# src/newgrf_station.cpp
# src/order_gui.cpp
# src/rail_cmd.cpp
# src/saveload/saveload.cpp
# src/settings.cpp
# src/settings_gui.cpp
# src/settings_internal.h
# src/settings_type.h
# src/station_cmd.cpp
# src/stdafx.h
# src/table/currency_settings.ini
# src/table/misc_settings.ini
# src/table/settings.h.preamble
# src/table/settings.ini
# src/terraform_cmd.cpp
# src/timetable_gui.cpp
# src/train_cmd.cpp
# src/tree_cmd.cpp
# src/water_cmd.cpp
2021-09-27 22:47:23 +01:00
Rubidium
bb9121dbd4
Fix: comparison of narrow type to wide type in loop (potential for infinite loops)
2021-05-15 10:16:10 +02:00
Jonathan G Rennison
32dcc0d484
Linkgraph: Fix unused expression result warning
2021-03-02 23:45:08 +00:00
Jonathan G Rennison
b7ddd486cf
Merge branch 'master' into jgrpp
...
# Conflicts:
# cmake/CompileFlags.cmake
# src/aircraft_cmd.cpp
# src/blitter/32bpp_anim.cpp
# src/cargopacket.cpp
# src/cheat_gui.cpp
# src/company_cmd.cpp
# src/company_gui.cpp
# src/core/pool_func.hpp
# src/date.cpp
# src/economy.cpp
# src/error_gui.cpp
# src/ground_vehicle.cpp
# src/ground_vehicle.hpp
# src/group_gui.cpp
# src/industry_cmd.cpp
# src/lang/dutch.txt
# src/lang/french.txt
# src/lang/german.txt
# src/linkgraph/linkgraph_gui.cpp
# src/linkgraph/mcf.cpp
# src/network/network_content.cpp
# src/network/network_server.cpp
# src/network/network_udp.cpp
# src/newgrf_engine.cpp
# src/newgrf_station.cpp
# src/order_cmd.cpp
# src/order_gui.cpp
# src/pathfinder/follow_track.hpp
# src/pathfinder/yapf/yapf_common.hpp
# src/saveload/saveload.cpp
# src/settings_gui.cpp
# src/station_cmd.cpp
# src/station_kdtree.h
# src/string_func.h
# src/table/settings.ini
# src/tgp.cpp
# src/timetable_cmd.cpp
# src/timetable_gui.cpp
# src/toolbar_gui.cpp
# src/town_cmd.cpp
# src/train_cmd.cpp
# src/train_gui.cpp
# src/tree_gui.cpp
# src/tunnelbridge_cmd.cpp
# src/vehicle.cpp
# src/vehicle_gui.cpp
# src/video/sdl2_v.cpp
# src/video/sdl_v.cpp
# src/video/win32_v.cpp
# src/viewport.cpp
# src/viewport_sprite_sorter_sse4.cpp
# src/window.cpp
2021-02-01 17:07:34 +00:00
Charles Pigott
9b800a96ed
Codechange: Remove min/max functions in favour of STL variants ( #8502 )
2021-01-08 11:16:18 +01:00
Jonathan G Rennison
94d629d79b
Change: [Linkgraph] Allow job threads to be aborted early when clearing schedule ( #8416 )
...
When link graph jobs are cleared due to abandoning the game or exiting,
flag the job as aborted.
The link graph job running in a separate thread checks the aborted flag
periodically and terminates processing early if set.
This reduces the delay at game abandon or exit if a long-running job
would otherwise still be running.
2020-12-25 00:36:36 +01:00
Jonathan G Rennison
c50ee4efec
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/linkgraph/mcf.cpp
2020-01-10 18:46:20 +00:00
Jonathan G Rennison
6e7117e04c
Codechange: [Linkgraph] Skip MCF source node Dijkstra when all demand satisfied
...
MCF Dijkstra iterations are executed for all source nodes in a round-robin order.
Source nodes typically require different numbers of MCF Dijkstra iterations
to satisfy all of their demand.
This change is to avoid performing MCF Dijkstra iterations on source nodes which
have already been fully satisfied.
2020-01-08 22:49:53 +01:00
Jonathan G Rennison
3e8b091913
Linkgraph: MCF: Skip source node Dijkstra when all demand satisfied
2019-10-06 17:55:04 +01:00
Jonathan G Rennison
4438413f48
Linkgraph: Replace RB-tree with B-tree in MCF Dijkstra
2019-10-05 12:31:56 +01:00
Jonathan G Rennison
0246d59c8d
FlowStat: Replace btree_map with flat map which is inlined in small case
...
Inline storage for size <= 2
Size = 1 is ~90%
Size = 2 is ~9%
Size >=3 is ~1% and gets a separate allocation
2019-10-01 02:34:15 +01:00
Jonathan G Rennison
90550d9642
FlowStatMap: Replace RB-tree with btree-indexed vector
2019-10-01 02:13:33 +01:00
Jonathan G Rennison
674732cd68
Merge: Codechange: Use null pointer literal instead of the NULL macro
2019-04-11 18:14:13 +01:00
Henry Wilson
7c8e7c6b6e
Codechange: Use null pointer literal instead of the NULL macro
2019-04-10 23:22:20 +02:00
Jonathan G Rennison
e735c1a51a
Merge branch 'master' into jgrpp
...
# Conflicts:
# src/aircraft_cmd.cpp
# src/autoreplace_cmd.cpp
# src/pathfinder/follow_track.hpp
# src/pathfinder/yapf/yapf_rail.cpp
# src/saveload/afterload.cpp
# src/saveload/saveload.cpp
# src/script/api/ai/ai_station.hpp.sq
# src/script/api/game/game_station.hpp.sq
# src/script/api/script_station.hpp
# src/track_func.h
# src/vehicle_base.h
2018-11-05 12:53:36 +00:00
Charles Pigott
f5b1115039
Doc: Lots and lots of doxymentation fixes
2018-10-31 12:35:54 +01:00
Jonathan G Rennison
cd68e9fac7
Linkgraph: Do not pre-fill annos set at start of MCF Dijkstra
2018-01-15 22:40:54 +00:00
Jonathan G Rennison
4a420ef864
Linkgraph: Use cached value in capacity annotation comparison
2018-01-15 22:40:54 +00:00
Jonathan G Rennison
117b56caeb
Linkgraph: Replace a std::list with a std::vector.
2017-02-08 22:08:39 +00:00
Jonathan G Rennison
c86a027e88
Linkgraph: Use an arena allocator for path objects.
...
Fixes leaks when job is aborted early.
2017-02-08 22:03:59 +00:00
Jonathan G Rennison
3f2c561867
Linkgraph: Add support for aborting MCF passes early.
2017-02-08 22:00:35 +00:00
Jonathan G Rennison
9d5f34fea6
Replace various uses of std::set/map with btree containers.
2017-02-08 00:18:09 +00:00
Jonathan G Rennison
7b56097f50
Merge branch 'master' into jgrpp
...
# Conflicts:
# config.lib
# src/linkgraph/demands.cpp
# src/linkgraph/mcf.cpp
# src/linkgraph/refresh.cpp
# src/linkgraph/refresh.h
# src/smallmap_gui.cpp
2016-07-24 10:16:55 +01:00
fonsinchen
022b284064
(svn r27613) -Codechange: Use a flat vector instead of a map in FlowEdgeIterator. (JGR)
2016-07-10 12:03:23 +00:00
fonsinchen
a81b7a24a6
(svn r27613) -Codechange: Use a flat vector instead of a map in FlowEdgeIterator. (JGR)
2016-07-10 12:03:23 +00:00
fonsinchen
bcdae9a093
(svn r27611) -Codechange: Cache the calculated value of CapacityAnnotation
2016-07-10 11:53:43 +00:00
fonsinchen
8d5566651b
(svn r27611) -Codechange: Cache the calculated value of CapacityAnnotation
2016-07-10 11:53:43 +00:00
Jonathan G Rennison
58b6bf16c3
Linkgraph: Enable MCF custom allocator only for GCC 4.9+
...
Earlier compilers don't use std::allocator_traits to query allocators.
2015-11-29 19:10:16 +00:00
Jonathan G Rennison
e22e1df939
Store annotation and node ID in set key, to reduce ptr derefs on sort.
...
Store the set iterator in the node, for faster erasing during forks.
Use a custom pool allocator to store set nodes contiguously.
2015-11-27 01:02:55 +00:00
Jonathan G Rennison
0fb79a8f15
Use a flat vector instead of a map in FlowEdgeIterator.
...
This reduced the cost of Dijkstra<CapacityAnnotation> by approx. 25%,
in a test profiling.
2015-11-26 18:23:10 +00:00
Jonathan G Rennison
564744d427
Cache the calculated value of CapacityAnnotation.
...
This is because CapacityAnnotation::Comparator::operator()
was appearing at the top of profiler output due to regenerating
the annotation value on every comparison when performing a set operation.
2015-11-25 23:05:55 +00:00
frosch
a14b836bf2
(svn r27178) -Fix [FS#5969]: Data race due to lazy initialisation of objects.
2015-03-07 18:27:01 +00:00
frosch
780e595933
(svn r27178) -Fix [FS#5969]: Data race due to lazy initialisation of objects.
2015-03-07 18:27:01 +00:00
rubidium
0c2f4bdc2b
(svn r27020) -Cleanup: some coding style consistency improvements (mostly spaces)
2014-10-15 18:31:37 +00:00
rubidium
d534c80e94
(svn r27020) -Cleanup: some coding style consistency improvements (mostly spaces)
2014-10-15 18:31:37 +00:00
fonsinchen
ef2caa02b2
(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link graphs to reduce size.
2014-06-14 13:35:39 +00:00
fonsinchen
957f5ca117
(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link graphs to reduce size.
2014-06-14 13:35:39 +00:00
rubidium
2be4215f43
(svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2014-04-23 20:13:33 +00:00
rubidium
0463dbdc9e
(svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values
2014-04-23 20:13:33 +00:00
fonsinchen
6580fd4b8f
(svn r25885) -Codechange: Keep paths sorted so that the ones with flow == 0 are in the back and don't have to be iterated over so often.
2013-10-19 17:15:19 +00:00
fonsinchen
b3b460cae2
(svn r25885) -Codechange: Keep paths sorted so that the ones with flow == 0 are in the back and don't have to be iterated over so often.
2013-10-19 17:15:19 +00:00
fonsinchen
1cc410f7bb
(svn r25356) -Add: Multi-Commodity-Flow solver for link graph
2013-06-09 13:00:41 +00:00
fonsinchen
9824d53d6a
(svn r25356) -Add: Multi-Commodity-Flow solver for link graph
2013-06-09 13:00:41 +00:00