haskellGeneticTSP

所属分类:人工智能/神经网络/深度学习
开发工具:Haskell
文件大小:8KB
下载次数:0
上传日期:2016-05-24 23:32:00
上 传 者sh-1993
说明:  使用遗传编程的旅行推销员。
(Travelling salesman using genetic programming.)

文件列表:
Cities.hs (152, 2016-05-25)
City.hs (422, 2016-05-25)
Individual.hs (1134, 2016-05-25)
Init.hs (1183, 2016-05-25)
LICENSE (1059, 2016-05-25)
Lib.hs (236, 2016-05-25)
Main.hs (3953, 2016-05-25)
Population.hs (6067, 2016-05-25)
Setup.hs (46, 2016-05-25)
geneticTSP.cabal (1142, 2016-05-25)

(C) Ricardo Cristovao Miranda, 2016. This program is a Haskell solution to the problem described in Genetic Algorithms in Java Basics, Lee Jacobson, Burak Kanber, chapter 4, Traveling Salesman. From the book: The traveling salesman problem is often described in terms of optimizing a route through a collection of cities; however, the traveling salesman problem can be applied to other applications. For example, the notion of cities can be thought of as customers for certain applications, or even as soldering points on a microchip. The idea of distance can also be revised to consider other constraints such as time. The problem we will be tackling in this implementation is a typical traveling salesman problem in which we need to optimize a route through a collection of cities. We can generate a number of random cities in 2D space by setting each city to a random x, y position. The encoding we choose in this example will need to be able to encode a list of cities in order. We can do this by assigning each city a unique ID then referencing it using a chromosome in the order of the candidate route. This type of encoding where sequences of genes are used is known as permutation encoding and is very well suited to the traveling salesman problem. The first thing we need to do is assign our cities unique IDs. If we have 5 cities to visit, we can simply assign them the IDs: 1,2,3,4,5. Then when our genetic algorithm has found a route, our chromosome may order the city IDs to look like the following: 3,4,1,2,5. This simply means we would start at city 3, then travel to city 4, then city 1, then city 2, then city 5, before returning back to city 3 to complete the route.

近期下载者

相关文件


收藏者