GithubHelp home page GithubHelp logo

tzesh / mtsp Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 140 KB

Multiple Traveling Salesman Problem. Computer Engineering and Industrial Engineering multidisciplinary project.

License: Apache License 2.0

Java 100.00%
heuristic-algorithm heuristic-optimization mtsp

mtsp's Introduction

mTSP (Multiple Traveling Salesman Problem)

The multiple traveling salesman problem (mTSP) is a generalization of the well-known traveling salesman problem (TSP), where more than one salesman is allowed to be used in the solution. In this project, we are using 4 different approaches to find a solution to this problem in the given Turkey's cities and their distances.

  1. Random solution: Shuffles all the cities, then adds them randomly to make a path. And divides paths into depots then routes. Does 100.000 iterations and picks the best one.
  2. Random solution with Heuristic algorithms: Same methodology of random solution but afterwards it does 'Improvement Heuristics' for 5.000.000 times (A.K.A Heuristic algorithms) randomly and if there is an improvement does not undo the Heuristic algorithm applied.
  3. Nearest Neighbor solution: It is a Construction Heuristic it takes a city as parameter and makes that city the main depot in the first place. And then generates a path according to closest path that could be generated. Then subdivides the path into depots then routes. Main depot which is given as parameter should be center city (which has the minimum distance to all the cities except itself).
  4. Nearest Neighbor solution with Heuristic algorithms: Applies the same solution with Nearest Neighbor then does the Heuristic algorithms for 5.000.000 iterations as mentioned in Random Solution with Heuristics.

In this project, we've tried to look for the best combination to solve the problem. The substructure of the project belongs to 'mTSP'. We didn't fork the repository to let other CENG candidates to think about the problem and gain experience.

For the tests that we've done so far, 'Nearest Neighbor solution with Heuristics algorithms' is the best solution that gives minimum cost. You can easily browse these solutions in 'example_solutions' folder.

Usage

This application does both 4 solutions for once. You can easily change that value to how many iterations do you want to do. All you have to do is changing the -i parameter while executing. Just compile or download the latest version and then run the mTSP.jar with command java -jar mTSP.jar. By default application will build a route with 5 depots and 2 salesmen per depot. You can use these parameters:

  • -d 'number of depots': to specify the number of depots (default 5)
  • -s 'number of salesmen per depot': to set the number of salesmen per depot (default 2)
  • -v: to use verbose mode which allows you to see city names instead of indexes (default false)
  • -i: to specify how many iterations will be generated for both 4 approaches (default 1)
  • -p: to change the main (initial) depot of NN solution by entering plate number (default 38 - center city of Turkey)
  • -m: maintain the main depot as main depot in NN solutions (default false)
  • -h: to see all the parameters For instance, you can use java -jar mTSP.jar -d 7 -s 5 -v to generate a route with using these approaches which has 7 depots and 5 salesmen per depot, and also application will print city names instead of indexes. Footage 1 Footage 2

mtsp's People

Contributors

tzesh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.