{"id":26851678,"url":"https://github.com/kk-mp4/bolt-routing-problem","last_synced_at":"2025-10-07T15:06:14.125Z","repository":{"id":41353895,"uuid":"509197583","full_name":"KK-mp4/Bolt-Routing-Problem","owner":"KK-mp4","description":"Different algorithms for connecting stations in a piston bolt network","archived":false,"fork":false,"pushed_at":"2022-07-02T19:59:16.000Z","size":154,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-25T16:47:58.655Z","etag":null,"topics":["combinatorial-optimization","graph-theory","minecrft"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KK-mp4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-30T18:49:50.000Z","updated_at":"2022-10-24T20:17:23.000Z","dependencies_parsed_at":"2022-08-25T11:41:09.270Z","dependency_job_id":null,"html_url":"https://github.com/KK-mp4/Bolt-Routing-Problem","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KK-mp4%2FBolt-Routing-Problem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KK-mp4%2FBolt-Routing-Problem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KK-mp4%2FBolt-Routing-Problem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KK-mp4%2FBolt-Routing-Problem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KK-mp4","download_url":"https://codeload.github.com/KK-mp4/Bolt-Routing-Problem/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390878,"owners_count":20769476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["combinatorial-optimization","graph-theory","minecrft"],"created_at":"2025-03-30T22:32:52.387Z","updated_at":"2025-10-07T15:06:09.093Z","avatar_url":"https://github.com/KK-mp4.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minecraft Piton Bolt Network Routing Problem (work in progress)\n## Different algorithms for connecting stations in a piston bolt network\n\nWith all the new development in [piston bolt tech](https://youtube.com/playlist?list=PLI-RNUGw-AeRkX7MQm9ArljzVCuuSzg0y) old servers might consider rebuilding their piston bolt network in the nether.\n\nWhen you already know where the stations will be it is an interesting [combinatorial optimization](https://en.wikipedia.org/wiki/Combinatorial_optimization) problem of how to connect all stations with piston bolts in a way that your system is **both easy** to build (has smallest total piston bolt length) **and fast** (has smallest average piston bolt travel time between any set of two stations). I was always sleeping at [graph theory](https://en.wikipedia.org/wiki/Graph_theory) lectures, so I'm not saying that this is good stuff I coded in here.\n\n## Problem Domain\nGeneralizing and looking outside the Minecraft this problem comes down to finding an optimal interconnect for a given set of points (stations) on a Euclidean 2 dimentional plane. Minecraft restriction adds to this problem the fact that plane is actually a rectilinear lattice graph. So classical euclidean geometry is getting replaced.\nGraph itself will be weighted and [undirected](https://en.m.wikipedia.org/wiki/Graph_(discrete_mathematics)#Undirected_graph), since ether people always build bolts both ways, or maybe you managed to get falling end portal, thus allowing you to teleport back to spawn instantly. Weight of a vertex will be calculated using [Chebyshev distance](https://en.wikipedia.org/wiki/Chebyshev_distance) since it takes same amount of time to go 1 block ether diagonally or straight.\n\nFor all the calculations I will use coordinates of stations at [Dugged SMP](https://redirect.dugged.net:8443/map/#Survival-Nether-Top/0/7/128/-442/64), but same can be applied to any.\u003cbr/\u003e\n\n![image](https://user-images.githubusercontent.com/103208695/176758019-9b6523cc-89e9-464a-837e-a7187b8d20b1.png)\n\n### 1. Merging at coordinates.\nFirst solution doesn’t go far from the existing system. All stations are connected to a single internal node (portal to main storage system in our case), in graph theory this is also called a [star network](https://en.m.wikipedia.org/wiki/Star_(graph_theory)). But it is optimized from what we currently have by going as much as possible diagonally before going straight. That way we shorten travel time (since diagonally we travel sqrt((20^2)+(20^2)) = 28.28 m/s instead of 20 m/s).\u003cbr/\u003e\n![image](https://user-images.githubusercontent.com/103208695/176998754-63e4d135-e6cb-41ab-8d84-6db799609430.png)\n|||\n| ------------- | ------------- |\n| Bolt count  | 29 |\n| Total bolt distance  | 19.2 km  |\n| Total travel time  | 16 min  |\n| Average travel time  | 66.1 sec  |\n\n### 2. Merging at average coordinates.\nSomething that sounds like a good idea but is not.\u003cbr/\u003e\n![image](https://user-images.githubusercontent.com/103208695/176998779-be364226-eeb7-4b0a-9324-64b2aabe47ba.png)\n|||\n| ------------- | ------------- |\n| Bolt count  | 29 |\n| Total bolt distance  | 19.6 km  |\n| Total travel time  | 16.4 min  |\n| Average travel time  | 67.7 sec  |\n\n### 3. All to All\nOf course I had to try this, theoretically shortest amount of travel time - 16 sec less than previous results.\u003cbr/\u003e\n![image](https://user-images.githubusercontent.com/103208695/176998799-48fed7fc-65a2-462a-a2dd-3bad63811843.png)\n|||\n| ------------- | ------------- |\n| Bolt count  | 435 |\n| Total bolt distance  | 432 km  |\n| Total travel time  | 360 min  |\n| Average travel time  | 50 sec  |\n\n### 4. [Nearest Neighbour (NN) algorithm](https://en.wikipedia.org/wiki/Nearest_neighbour_algorithm)\nHeuristic solution to [travelling salesman problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem). This should find the shortest rout possible without additional stations (terminals) by going to each station only once. I tried starting from different stations and seems like our downaccel gold farm gives the shortest total bolt distance - 2 times less than what we currenly have. Sadly average travel time got 3 times more than what we currently have.\u003cbr/\u003e\n![image](https://user-images.githubusercontent.com/103208695/176998817-9e8a011d-32d2-4461-86ba-0584786e0263.png)\n|||\n| ------------- | ------------- |\n| Bolt count  | 29 |\n| Total bolt distance  | 11.7 km  |\n| Total travel time  | 9.8 min  |\n| Average travel time  | 293 sec  |\n\n### 5. Loop\nSmall improvement to average travel time for NN algorithm we can do is to close the loop, this decreases travel time by 50%.\u003cbr/\u003e\n![image](https://user-images.githubusercontent.com/103208695/176998841-85e70cb8-453b-42c1-a045-5c47a00e5edd.png)\n|||\n| ------------- | ------------- |\n| Bolt count  | 30 |\n| Total bolt distance  | 14.6 km  |\n| Total travel time  | 12.2 min  |\n| Average travel time  | 182.7 sec  |\n\n### 6. [Rectilinear Steiner tree](https://en.m.wikipedia.org/wiki/Steiner_tree_problem)\nWork in progress on a heuristic [algorithm](https://www.textroad.com/pdf/JBASR/J.%20Basic.%20Appl.%20Sci.%20Res.,%203(1s)611-613,%202013.pdf) for constracting Stainer minimal tree\u003cbr/\u003e\n\n# Getting started\nEh, it is not really user friendly, find Bolt_List.json and enter your stations by hand.\u003cbr/\u003e\n![image](https://user-images.githubusercontent.com/103208695/176999826-1f5e58fc-1c66-46b0-b786-b07adbca8225.png)\n\n# License\nThis program is licensed under the GNU General Public License v3.0. Please read the License file to know about the usage terms and conditions.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkk-mp4%2Fbolt-routing-problem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkk-mp4%2Fbolt-routing-problem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkk-mp4%2Fbolt-routing-problem/lists"}