Пример #1
0
        public GaTSP(GAParams tParams)
        {
            lstPopulation = new List <Genome>();

            Params = tParams;

            this.fittestGenome = 0;
            this.generation    = 0;
            this.shortestRoute = double.MaxValue;
            this.longestRoute  = 0;

            objRandom = new Random();

            objMap = new MapTSP(tParams.numberOfCities);
            CreateStartingPopulation();
        }
Пример #2
0
        public GaTSP(double mutationRate, double crossoverRate, int populationSize, int numberOfCities)
        {
            lstPopulation = new List <Genome>();

            this.mutationRate     = mutationRate;
            this.crossoverRate    = crossoverRate;
            this.populationSize   = populationSize;
            this.fittestGenome    = 0;
            this.generation       = 0;
            this.shortestRoute    = double.MaxValue;
            this.longestRoute     = 0;
            this.chromosomeLength = numberOfCities;

            objRandom = new Random();

            objMap = new MapTSP(numberOfCities);
            CreateStartingPopulation();
        }