Giter Club home page Giter Club logo

tsp-bb's Introduction

Solver for TSP

Features

  • Solve TSP including those that do not satisfy triangle inequality
  • Solve TSP faster than O(n^2 * 2^n) DP

Usage

  1. build
make
  1. run
bin/bb.out tests/n_20/tsp_n_20_p_1.0_1.tsp

Algorithms

Source File Description
src/bb.cpp Branch and Bound algorithm with O(n) to bound
src/bb_flow.cpp Branch and Bound algorithm with O(n\sqrt{n}) to bound
src/dp.cpp O(n^2 * 2^n) DP algorithm
src/b.cpp Branch algorithm (withoud bounding)

Performance

The performance (average running time) benchmarked by tests/ files is as follows.

Testcases src/bb.cpp src/bb_flow.cpp src/dp.cpp src/b.cpp
tests/n_16/* 0.01532 sec 0.13547 sec 0.03326 sec -
tests/n_18/* 0.03744 sec 0.65817 sec 0.11740 sec -
tests/n_20/* 0.15674 sec 3.97176 sec 0.48440 sec -
tests/n_22/* 0.36346 sec 10.63145 sec 2.19858 sec -
tests/n_24/* 0.96166 sec 31.60966 sec 9.79800 sec -
tests/n_26/* 1.20250 sec 41.17456 sec 53.70651 sec -
tests/n_28/* 5.00968 sec 194.83778 sec 445.56655 sec -
tests/n_30/* 44.71780 sec 830.41925 sec - -

tsp-bb's People

Contributors

drafear avatar

Watchers

James Cloos 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.