My cmp is :

bool fitnessCompare(chromosome first,chromosome second){
                return fitness(first)>fitness(second);
}

float fitness(chromosome victim){
        city[] cities=victim.dna;
        
        //we need to start from home and return to home
        cities=city(0,0) ~ cities;
        cities~=city(0,0);
        
        float travelled=0f;
        for(int x=0;x<cities.length-1;x++)
                travelled+=distance(cities[x],cities[x+1]);

        return 1/travelled;
}



I've posted my code too on pastebin : http://pastebin.com/7927Hpv2

Reply via email to