Git Product home page Git Product logo

rbala / 2obj-mtsp-nsga2 Goto Github PK

View Code? Open in Web Editor NEW
12.0 1.0 3.0 1.31 MB

Contains python code of an NSGA-II based solver with multiple genetic operator choices for the multiple travelling salesman problem with two objectives. Also contains sample instances from TSPLIB. (Deliverable for the ECE 750 AL: Bio & Comp Fall 2021 individual project @ UWaterloo)

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
python mtsp nsga-ii

2obj-mtsp-nsga2's Introduction

Multi-objective optimization of the Multiple Traveling Salesmen Problem Using a Non-dominated Sorting Genetic Algorithm (NSGA-II)

Deliverable for the ECE 750 Artificial Life: Biology and Computation Fall 2021 course @ UWaterloo

Author: Rahul Balamurugan

The NSGA-II algorithm is implemented faithful to the original as far as the non-dominated sorting, crowding distance operator, and binary crowded tournament selection go. However, the crossover and mutation operators are those meant for permutation based problems.

Available crossover operators: Partially-mapped crossover (PMX), Cyclic crossover (CX), Ordered crossover (OX), and heirarchical crossover (HX)(default). The HX operator is based on the proposed algorithm from the paper "An effective method for solving multiple travelling salesman problem based on NSGA-II" (2019) by Yang Shuai, Shao Yunfeng & Zhang Kai. Available at https://doi.org/10.1080/21642583.2019.1674220.

Implemented mutation operators: Insert mutation, Swap mutation, Invert mutation, and Scramble mutation. All four have an equal chance to be chosen if the child chromosome is selected for mutation.

Two objective functions for the MTSP: minimizing total distance traveled and two separate options for the second, either minimizing difference between max and min tour length (MinMax SD-MTSP) or minimizing difference between the maximum time taken for a tour and average across all salesmen. For the latter option, a random speed between 40 and 90 km/h is chosen for each arc traversal.

Available instances from TSPLIB: eil51, berlin52, eil76, and rat99.

Before Running:

Ensure you have python modules tqdm and tkinter installed and you are running Python 3

Instructions to run:

  1. Download code as zipped file.
  2. Unzip and open main.py in an editor (if you want to change parameters)
  3. Inside main.py, change variables as desired in function main()
  4. Run main.py and select instance when prompted ('random' for random instance generation)
  5. Also select 'yes' or 'no' for saving the image and obtained fronts when prompted
  6. If 'yes' was selected (default), results will be in a folder named 'Results' which will be created automatically if not present in the working directory. Results include .png figure of the optimal pareto front and the .pkl file containing the dictionary of fronts obtained in last generation.

2obj-mtsp-nsga2's People

Contributors

rbala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.