GithubHelp home page GithubHelp logo

deno750 / tsp_optimization Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 42.55 MB

Repository for the course Operations Research 2

License: MIT License

CMake 0.73% C 65.89% Python 17.68% Jupyter Notebook 9.76% HTML 4.42% JavaScript 1.20% Shell 0.06% Dockerfile 0.25%
tsp traveling-salesman-problem cplex tabu-search user-cuts operations-research heuristics optimization linear-programming operational-research

tsp_optimization's Introduction

Release Contributors Forks Stargazers Issues


Logo

Traveler salesman problem optimization

Various algorithms to solve the traveler salesman problem!
馃搫Paper馃暪锔廘ive Demo馃悶Report Bug鈿欙笍Request Feature

Table of Contents

Overview

This is a project for the course Operations Research 2 taken by prof. Matteo Fischetti in the a.y. 2020/2021

This project focuses on solving TSPs with different algorithms

Download

You can download the latest release from here

Structure

Here we describe how the project folder is organized:

  • build is a generated folder by cmake which contains all the files needed for building the project and its executable
  • data folder contains the .tsp files
  • docs contains the documentation of the data formatting taken from TSLIB
  • include contains the .h files of the project
  • libs contains the third pary libraries utilized in this project.If it's not present, create it
  • logs is a generated folder when a method which uses CPLEX is utilized. It contains the CPLEX's log files
  • results contains the performance profile experiments saved in .csv files and some comparison charts saved in .pdf files
  • model is a generated folder which contains .lp files generated by CPLEX
  • other_codes contains some python scripts which are useful for performance profiles etc
  • plot contains the solved plots of the problems
  • src contains the source files of the project
  • test not used
  • tour is a generated folder which saves the .tour files in TSPLIB format. Those files contain the information of the problem's solution
  • webapp contains the backend and the frontend

Installation

To compile this repository, Cplex and Concorde are required. To install Cplex you can follow IBM's guide.

To install Concorde, follow the following steps:

  • Download Concorde's zipped tar file from here
  • Extract it in the libs folder. You should now have libs/concorde. Note if the libs folder is not present, create it
  • Now using terminal type cd libs/concorde
  • Now type ./configure. If you're MacOS user, type ./configure --host=darwin
  • When the latest comand finishes, type make to conclude the installation

If you want details on how to install concorde, check this guide

When all the requirements are satisfied, you can finally compile the project. Once you have configured the the project with CMake based on your IDE and environment, to compile the project you have to go in build folder typing cd build and type make.

Usage

Use from command line

The input data is given TSPLIB The format is described in tsp95.pdf

To run the program, inside the build folder, type ./tsp. To see all the command line options, use ./tsp --help. To see the list of the methods available, use ./tsp --methods.

An example of usage is: ./tsp -f ../data/att48.tsp -method GG -t 300 -verbose 4

To plot the TSP solution in a png file, gnuplot must be installed. You can install it from your OS repository such as apt install gnuplot on ubuntu or brew install gnuplot on MacOS.

If you're on windows, use Windows Subsistem for Linux (WSL). The native compatibility on windows is not supported

Use the Web App

Using docker (easiest way):

  • docker build -t tsp-webapp .
  • docker run -p 80:80 -d tsp-webapp

Install pip:

  • sudo apt update
  • sudo apt install python3-pip
  • pip3 --version

Install Flask:

  • sudo apt install python3-venv
  • Go to the folder that contains backed.py:
  • python3 -m venv venv
  • To start using this virtual environment: source venv/bin/activate
  • (venv) $ pip install Flask
  • (venv) $ python -m flask --version
  • (venv) $ pip install -U flask-cors

Start the application locally:

  • (venv) $ export FLASK_APP=backend.py
  • (venv) $ flask run
  • Open http://127.0.0.1:5000 in your web browser and you will see the website

Start the applicaton on production server:

  • (venv) $ export FLASK_APP=backend.py
  • (venv) $ nohup flask run --host=0.0.0.0 --port=80
  • OR in the project root folder execute nohup ./runBacked.sh

To stop the development server type CTRL-C in your terminal.

To deactivate the Virtual Environment: (venv) $ deactivate

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

License

MIT license

Copyright (c) 2021 Denis Deronjic & Stefano Ivancich

tsp_optimization's People

Contributors

deno750 avatar ivaste avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zdqf

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.