/AI-simulated-annealing-algorithm-TSP

Using Simulated Annealing (SA) algorithm to improve an initial solution from Nearest Neighbor Search (NNS) for Travelling Salesman Problem (TSP).

Primary LanguageJupyter Notebook

Simulated Annealing Algorithm-TSP

This repository contains programs using classical Machine Learning algorithms to Artificial Intelligence implemented from scratch and Solving traveling-salesman problem (TSP) using an goal-based AI agent.

This project is about finding a solution to the traveling-salesman problem (TSP) using a so called goal-based AI agent. The goal is to find a cycle (a roundtrip) which visits every city once, while traveling the minimal possible distance.

A search algorithm called Simulated Annealing search has been used, which is a algorithms from the family of local search algorithms.Simulated annealing is a probabilistic technique for approximating the global optimum of a given function. Specifically, it is a metaheuristic to approximate global optimization in a large search space for an optimization problem. It is often used when the search space is discrete

DATA:

For this project Qatar and Djibouti cites loaction have been used. Qater data is in DATA/qa194.tsp directory. Djibouti data is in DATA/dj38.tsp directory.

How to use

  1. Google Colab:
    1. Copy Simulated_annealing.ipynb file in your google drive
    2. Copy data in data folder in your google drive
    3. Open Simulated_annealing.ipynb in your google drive
    4. change data path in the code
  2. .py file:
    1. Open Simulated_annealing.py in your pyhton code editor
    2. Change data path in python code
    3. Run the code

Properties of the task environment

  • Fully observable
  • Single agent
  • Stochastic
  • Episodic
  • Static
  • Discrete
  • Known

Descriptions of the files of this project:

  1. Project.pdf
    • In this file, all details about the project have been explained.
  2. Report.pdf
    • Report file for the project. All results of implemented python codes with plots are visible here.
  3. Simulated_annealing.ipynb
    • Simulated Annealing google colab code
  4. Simulated_annealing.py
    • Simulated Annealing python code

Unfortunately "Project.pdf" and "Report.docx" are only available in "Persian". If you seriously need a translation, contact me.

Example of the resulting route on a TSP:

68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f336f686a554f4e6679354971626158316b592f67697068792e676966

image