GithubHelp home page GithubHelp logo

inspiaaa / tsp-simulated-annealing Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 4.66 MB

An interactive Travelling Salesman Problem solver using simulated annealing

License: MIT License

C# 100.00%
algorithms csharp godot godot4 simulated-annealing traveling-salesman-problem travelling-salesman-problem tsp tsp-problem tsp-solver app godot-engine

tsp-simulated-annealing's Introduction

Simulated Annealing TSP Solver

Godot 4

This project is an interactive visualisation of the travelling salesman problem (TSP) being solved by a simulated annealing based algorithm. For comparison, it has the option to simultaneously display the solution generated by a greedy algorithm.

The app is made using Godot 4. The program logic is written in C# and the rendering is hardware accelerated.

Getting Started

  1. Download the latest version of the app from the releases page.

  2. Extract the files from the zip file.

  3. Run the executable.

  4. See the next section for usage instructions.

Basic controls

  • Manually advance the animation one logic step at a time by pressing the Next Step button.

  • Play the animation by pressing the Play / Pause button. The speed of the animation can be changed via the slider found below the aforementioned button.

  • Reset the animation by pressing the Restart button.

  • Generate a new TSP problem by editing the number of cities at the top of the UI and then pressing the New Cities button. This will update the solution of the greedy solver and also reset the simulated annealing process.

  • Compare the result obtained by the simulated annealing algorithm with the result of the greedy solver by ...

    • ... having a look at the round trip distances (See the Dist.: fields)

    • ... comparing the routes visually by showing / hiding the route of the greedy solver (use the Show check button)

Camera controls

  • Zoom in using the mouse wheel.

  • Move the camera by holding down the middle mouse button and moving the mouse.

Options

  • By hovering over an option, a tooltip appears after a short delay.

  • By selecting the Use greedy route as start option, the route obtained by the greedy algorithm will be used as the input and starting point for the simulated annealing process. This can lead to better end results in some cases.

  • Sometimes when the temperature of the system is low, the algorithm converges on a local minimum and is unable to escape as this would require multiple ineligible operations which would temporarily increase the distance. To escape these minima, you can enable the Reheat feature, which increases the temperature parameter when it cools down to a predefined threshold (that can be set in the advanced settings).

Advanced Settings

  • At the bottom of the UI you will find the advanced settings that give you access to the internal parameters used by the simulated annealing algorithm.

  • You can change all of the settings on the fly, without having to restart the simulation for them to take effect.

  • Besides being able to customise the starting temperature, you can also change the speed at which it is reduced via the Decay speed slider. The resulting temperature decay parameter that is used as the base of the internal exponential function that describes the temperature over time can be found in the Information section.

  • The Reheat Settings let you configure the threshold temperature at which the "reheat" feature activates, as well as the temperature increase that it engenders.

  • At the very bottom you can see the current iteration number.

Example

50 cities, reheat enabled, using default advanced settings:

tsp-simulated-annealing's People

Contributors

inspiaaa avatar

Stargazers

Jean-Philippe Deblonde 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.