Coder Social home page Coder Social logo

tsp-visualisation's Introduction

Application Icon

TSP-Visualisation

Node based travelling salesman problem visualisation in Java. Generates a nearest neighbour path then optimises with iterative 2-opt swaps in order to find a sub optimal "shortest" path.

Usage

Download the jar.

Linux

One-liner:

sudo apt update && sudo apt install openjdk-8-jre && sudo update-alternatives --config java && java -jar /path/to/TravellingSalesman.jar 

Execute the jar file:

java -jar /path/to/TravellingSalesman.jar

If Java 8 is not installed, install it using your local package manager, e.g:

sudo apt install openjdk-8-jre

If you are running a version of Java later than 8 then you must downgrade your current installation:

sudo update-alternatives --config java

Then select Java 8:

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-13-openjdk-amd64/bin/java      1311      auto mode
* 1            /usr/lib/jvm/java-13-openjdk-amd64/bin/java      1311      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 2

Done!

Windows

Run the jar with Java versions 8-17 (Java 8, 13 and 17 confirmed to work)

FAQ

Why is my FPS limited to 60?

It could be a problem with your Nvidia control panel settings.

3D Settings -> Manage 3D settings -> Global settings -> Vertical sync -> Use the 3D application setting

How it works

  • Get user input numNodes, proximity (Example 10, 2)
Nearest neighbour algorithm
  • Populate a list with 10 randomly placed nodes
  • For every node
    • find the distance to every other node
    • Randomly select from the 2 nearest other nodes and add it to a base route
2-Opt swap
  • Find 2 edges
  • Swap them
  • If the resulting route is shorter than the previous route
    • Keep the swap
  • Otherwise find the next 2 edges
  • Repeat until every edge has been checked with every other edge without any swaps occurring
  • A local minumum has now been found and the program will stop

tsp-visualisation's People

Contributors

freddycansic avatar imgbotapp avatar

Stargazers

 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.