Giter Club home page Giter Club logo

tsp-art's Introduction

TSP-Art a la Robert Bosch

Continuous-line drawings interpreted as solutions to the traveling salesman problem, in the style of Robert Bosch.

About

This repository is home to Python code that approximates a given .pbm image with a continuous-line drawing that is a solution to a traveling salesman problem.

    

To get the TSP tour-like image of Hank Marvin -- the image on the right -- do the following. First, use an image editor like Gimp to to get the stippled image in the middle by following these steps by Evil Mad Scientist Laboratories. It's easy to read the co-ordinates of the stipples when the stippled, or dithered, image is stored as a Portable Bit Map (PBM) file. For now, this code can handle only a type P1 PBM file --- the kind that stores the image's bit map in ASCII format. Next, send the co-ordinates to a TSP solver like Concorde. This code submits a job to the NEOS Server with Concorde set to the Lin-Kernighan heuristic. Finally, convert the returned tour sequence into an SVG image in Inkscape.

To Run Code

Run the script file Script.sh under folder CODE

> cd CODE/
> sh Script.sh HM black 1.3

The last command takes IMAGES/HM.pbm as input and returns a black line drawing IMAGES/TSP_IMAGES/HM.svg of the original image with line thickness 1.3px.

Things To Note

Starting with a "good" stippled image can make a world of difference to the aesthetic quality of the TSP line drawing. Robert Bosch and his collaborators write of several approaches (algorithms) to generate that "good" starting point. I took the easy way out and followed the Evil Mad Scientist's Gimp-based approach. It's the messier of the two routes (the other one being coding up the algorithms used by Bosch) in the sense that it can't be automated and requires relying on your eye.

Code Credit

  1. Ideas on reading PBM files in Python were borrowed from Evil Mad Scientist Laboratories' code for the same. Check it out.
  2. @kalyaninagaraj

Photo Credit

The image of Hank Marvin is cropped from a group photo of The Shadows that appears in the public domain.

References

  1. Robert Bosch makes art by performing mathematical optimization. This book review in the Scientific American of his book Opt Art is a great starting point.
  2. Check out all of Bob Bosch's Mathematical Art and the art of his inspiration, Ken Knowlton.

tsp-art's People

Contributors

kalyaninagaraj avatar

Stargazers

 avatar  avatar  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.