Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/justin-pyne/combinatorics-projects

Three Python scripts demonstrating combinatorics through permutations, combinations, and the Traveling Salesman Problem (TSP) solution using permutations.
https://github.com/justin-pyne/combinatorics-projects

Last synced: 6 days ago
JSON representation

Three Python scripts demonstrating combinatorics through permutations, combinations, and the Traveling Salesman Problem (TSP) solution using permutations.

Awesome Lists containing this project

README

        

# Combinatorics Projects

This repository contains three Python scripts that explore different aspects of combinatorics:

1. `generate_visualize_permutations.py`:
- Generates all possible permutations of a given list of elements.
- Visualizes each permutation as a series of colored blocks, where each color represents a different element.

2. `generate_visualize_combinations.py`:
- Generates all possible combinations of a given list of elements.
- Visualizes each combination as a series of colored blocks, where each color represents a different element.

3. `TSP_permutation_visualization.py`:
- Solves the Traveling Salesman Problem (TSP) using a brute force approach that explores all possible permutations of cities.
- Visualizes the cities on a scatter plot and the distances between them in a distance matrix.
- Outputs the minimum distance and optimal path for the salesman to take.

## How to Run the Scripts

1. Make sure you have Python installed on your computer.

2. Clone this repository to your local machine.

3. Install the necessary Python packages with the following command:
```
pip install -r requirements.txt
```

4. Run the desired script with the following command:
```
python .py
```