Skip to content

Genetic-Algorithm for solving Travelling Salesman Problems.

License

Notifications You must be signed in to change notification settings

Pleezon/JGeneticTSP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JGeneticTSP

Somewhat highly optimized Genetic-Algorithm for solving Travelling Salesman Problems.

Usage

	EuclideanTSPNode[] nodes = new EuclideanTSPNode[]{ // add wanted nodes to list
				new EuclideanTSPNode(new Pos2D(0, 50)),
				new EuclideanTSPNode(new Pos2D(32, 30)),
				new EuclideanTSPNode(new Pos2D(1, 52)),
				new EuclideanTSPNode(new Pos2D(-22, 13)),
				new EuclideanTSPNode(new Pos2D(-1, -31)),
		};
		TSP tsp = new TSP(nodes); // create TSP instance
		for (int i=0; i<100; i++){
			tsp.nextGeneration(); 
// repeat (this is normally done in combination with a check wether or not the current best is in a wanted range)
		}
		TSPNode[] finished = tsp.getBest();  // get result
		double cost = tsp.getCostOfBest(); // get cost of TSP path

About

Genetic-Algorithm for solving Travelling Salesman Problems.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages