I am trying to understand the terms genotype, phenotype and fitness in the Travelling Salesman Problem. Say I have 4 cities ABCD and their co-ordinates are (0,3)(1,4)(5,6)(2,9) what would be the genotype, phenotype and fitness of that?
The genotype is the "genetic" information of an individual of the population that should evolve towards an optimum using a Genetic Algorithm.
In the case of the Traveling Salesman Problem (TSP), the genotype is the specific way a tour is represented in your code. A tour, e.g. could be represented as a string of city names, a list of city numbers, a list of coordinate pairs, etc.
The phenotype is the visible structure of an individual, as it is obtained based on the genotype. In the TSP this would be the sequence of cities as they are visited.
The fitness of an individual is a number that say how "good" is the individual among the population. In TSP this is related to the tour length. Since one wants to minimize the tour length, the fitness could be
1/tourLength, or any other function of the tour length that is higher the shorter the tour is.