← Back

ofxTSP

github.com/elliotwoods/ofxTSP · @elliotwoods
OF 0.8 Utilities

Solve Travelling Salesman Problem in oF (primarily by brute force)

3 2 Last commit 12y ago Created 14y ago

README

<img src="https://github.com/elliotwoods/ofxTSP/raw/master/screenshot.png" />

Introduction



The Travelling Salesman Problem is a computational problem of finding the 'shortest route' between a set of nodes

Usage



Define your problem with the class ofxTSP::Problem :

	struct Problem {
		int destinationCount;
		map<Journey, float> distance;
	};


wherein an ofxTSP::Journey is defined as:

``c++ struct Journey { uint16_t start; uint16_t end; };

Then apply a ofxTSP::Solver using the function:

c++ vector<int> solve(const Problem & problem)
`

The returned
vector<int> has ordered elements which define the route

Currently the only available solver is
ofxTSP::BruteForce` as i've got a pretty simple problem here. Others will come later as necessary.

Get this addon

HTTPS
SSH