walky

A Highly Parallelized TSP Solver using MPI

https://github.com/lquenti/walky

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.4%) to scientific vocabulary

Keywords

high-performance-computing hpc mpi rust travelling-salesman-problem tsp
Last synced: 6 months ago · JSON representation ·

Repository

A Highly Parallelized TSP Solver using MPI

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 2
  • Releases: 3
Topics
high-performance-computing hpc mpi rust travelling-salesman-problem tsp
Created almost 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

Walky - A Highly Parallelized TSP Solver (Supports MPI!)

Walky is a highly parallelized solver for the Travelling Salesman Problem (TSP). It has the following features

  • Supports Exact Solving, Approximate Solving, and Lower Bound generation
  • Compatible with the canonical TSPLIB-XML format
  • Multiple Approximate Algorithms: Nearest Neighbour, Christofides Algorithm
  • Multiple Lower Bound Algorithms: Minimal Spanning Tree (MST), 1-tree
  • Support for Multithreading and distributed-memory, multi-node parallelism using MPI
  • Well documented, well tested, highly optimized

For a great visual introduction to the topic, the video essay by reducible is highly recommended.

Technical report

Besides the full docstring coverage on docs.rs, the main technical documentation is a very detailed technical report.

See ./technical-report/final_report.pdf for a deep dive on - How the algorithms work, including visualizations - The structure of the Rust project - Detailed benchmarks, including MPI analysis for cluster usage and much more.

Installation

Either use cargo (add --features mpi for MPI)

cargo install walky

Or build from git:

git clone https://github.com/lquenti/walky cd walky cargo build --release (--features mpi)

For benchmarking, the benchmarking feature can be used.

Usage

``` $ walky --help A TSP solver written in Rust

Usage: walky

Commands: exact Find the exact best solution to a given TSP instance approx Find an approximate solution to a given TSP instance lower-bound Compute a lower bound cost of a TSP instance help Print this message or the help of the given subcommand(s)

Options: -h, --help Print help -V, --version Print version ```

Exact Algorithm

Example invocation (Algorithm v5, multithreaded, example generated)

$ walky exact v5 -p multi-threaded utils/gen_matrix_fast/results/8.xml Best Cost: 47.85171352981164 Best Permutation: [0, 6, 1, 3, 5, 2, 7, 4]

Full usage:

``` $ walky exact --help Find the exact best solution to a given TSP instance

Usage: walky exact [OPTIONS]

Arguments: The Algorithm to use

      Possible values:
      - v0: Testing each possible (n!) solutions
      - v1: Fixating the first Element, so testing ((n-1)!) solutions
      - v2: Recursive Enumeration; Keep the partial sums cached
      - v3: Stop if partial sum is worse than previous best
      - v4: Stop if partial sum + greedy nearest neighbour graph is bigger than current optimum
      - v5: As V5, but use an MST instead of NN-graph as a tighter bound
      - v6: Cache MST distance once computed

Path to the TSPLIB-XML file

Options: -p, --parallelism Whether to solve it sequential or parallel

      [default: single-threaded]

      Possible values:
      - single-threaded: Run in a single threaded
      - multi-threaded:  Run in multiple threads on a single node

-h, --help Print help (see a summary with '-h')

-V, --version Print version ```

Approximate Algorithms

Example invocation (Algorithm christofides, multithreaded, example generated)

$ walky approx christofides -p multi-threaded utils/gen_matrix_fast/results/8.xml Christofides solution weight: 47.87647721988842

Full usage:

``` $ walky approx --help Find an approximate solution to a given TSP instance

Usage: walky approx [OPTIONS]

Arguments: The Algorithm to use

      Possible values:
      - nearest-neighbour: Starting at each vertex, always visiting the lowest possible next vertex
      - christofides:      The Christofides(-Serdyukov) algorithm, with randomized min-cost perfect matching solver

Path to the TSPLIB-XML file

Options: -p, --parallelism Whether to solve it sequential or parallel

      [default: single-threaded]

      Possible values:
      - single-threaded: Run in a single threaded
      - multi-threaded:  Run in multiple threads on a single node

-l, --lower-bound Whether to also compute a lower_bound. Optional

      Possible values:
      - one-tree:  The one tree lower bound
      - mst:       The MST lower bound
      - mst-queue: The MST lower bound, computed with prims algorithm using a priority queue

-h, --help Print help (see a summary with '-h')

-V, --version Print version ```

Lower Bound

Example invocation (Algorithm 1-tree, example generated)

$ walky lower-bound one-tree utils/gen_matrix_fast/results/8.xml 1-tree lower bound: 47.13382548327308

Full usage: ``` $ walky lower-bound --help Compute a lower bound cost of a TSP instance

Usage: walky lower-bound [OPTIONS]

Arguments: The Algorithm to use

      Possible values:
      - one-tree:  The one tree lower bound
      - mst:       The MST lower bound
      - mst-queue: The MST lower bound, computed with prims algorithm using a priority queue

Path to the TSPLIB-XML file

Options: -p, --parallelism Whether to solve it sequential or parallel

      [default: single-threaded]

      Possible values:
      - single-threaded: Run in a single threaded
      - multi-threaded:  Run in multiple threads on a single node

-h, --help Print help (see a summary with '-h')

-V, --version Print version ```

As a library call

let points = vec![[0.0, 0.0], [0.0, 1.0], [2.0, 3.0]]; let graph = NAMatrix::from_points(&points); let solution = christofides::<{ computation_mode::PAR_COMPUTATION }>(&graph);

Algorithms

The algorithms can be found in the technical report (which will be uploaded soon)

Test File Generation

Test XML files can be generated using utils/gen_matrix_fast/{gen,gen_big}.sh.

Licenses

This project is licensed under the MIT License.

Third Party Dependencies

This project includes the priority-queue crate, which is dual-licensed under LGPLv3 and MPLv2. You can find the source code of that project here: https://github.com/garro95/priority-queue. We can include the project in our project since the MPLv2 allows that: https://www.mozilla.org/en-US/MPL/2.0/FAQ/

Owner

  • Name: Lars Quentin
  • Login: lquenti
  • Kind: user
  • Location: Georg-August-Universität Göttingen
  • Company: @GWDG HPC dept

Future Senior Performance Engineer.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Quentin"
  given-names: "Lars"
- family-names: "Meyer"
  given-names: "Johann Carl"
title: "walky"
version: 0.1.0
date-released: 2023-06-30
url: "https://github.com/lquenti/walky"

GitHub Events

Total
Last Year

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 381
  • Total Committers: 5
  • Avg Commits per committer: 76.2
  • Development Distribution Score (DDS): 0.493
Past Year
  • Commits: 8
  • Committers: 2
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.25
Top Committers
Name Email Commits
Lars Quentin l****n@s****e 193
JayCeM j****l@o****e 175
jpursell j****l@g****m 6
Lars Quentin l****i 4
hpctraining75 GKRS h****5@g****r 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 15
  • Total pull requests: 48
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 3 days
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.47
  • Average comments per pull request: 0.69
  • Merged pull requests: 47
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lquenti (13)
  • johann-cm (2)
Pull Request Authors
  • lquenti (27)
  • johann-cm (18)
  • jpursell (2)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cargo 6,607 total
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 2
crates.io: walky

A TSP solver written in Rust

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 6,607 Total
Rankings
Dependent repos count: 28.9%
Dependent packages count: 33.9%
Forks count: 40.4%
Stargazers count: 47.3%
Average: 49.3%
Downloads: 96.2%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/general.yml actions
  • actions-rs/cargo v1 composite
  • actions-rs/clippy-check v1 composite
  • actions-rs/toolchain v1 composite
  • actions/checkout v3 composite
  • taiki-e/install-action nextest composite
Cargo.toml cargo
  • approx 0.5.1 development
  • clap 4.2.5
  • delegate 0.9.0
  • quick-xml 0.28.2
  • serde 1.0.160
utils/gen_matrix_fast/Cargo.toml cargo
utils/requirements.txt pypi
  • numpy *
  • python-tsp *