Skip to content

doilus/TSPGreedyAlgorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TSPGreedyAlgorithm

An example algorithm to determine the shortest path.

General info

The subject of the project is to implement a heuristic algorithm to calculate the shortest distance conntecting all the cities. Project is a traveling salesman problem. To solve the trouble I used greedy algorithm.

It was implemented using Java.

Data is from Luxembourg.

Data Source

Method

Step 1: Randomly pick one city.
Step 2: Generate all (n-!)! city permutations.
Step 3: Calculate the cost of each permutation and continue the path with the lowest cost. Keep a map with unvisited cities.
Step 4: After reaching the last city, return the lowest cost of all.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages