public MaxMinAntSystem2OptBest4QAP(QAPInstance instance, int numberAnts, double rho,
                                    double alpha, double beta, int maxReinit)
     : base(instance.NumberFacilities, QAPUtils.Fitness(instance, QAPUtils.RandomSolution(instance)),
            numberAnts, rho, alpha, beta, maxReinit)
 {
     Instance = instance;
 }
Beispiel #2
0
        public void Write(string file)
        {
            double cost = QAPUtils.Fitness(Instance, Assignment);

            using (StreamWriter writer = File.CreateText(file)) {
                writer.WriteLine(cost);
                writer.WriteLine(Instance.NumberFacilities);
                for (int i = 0; i < Instance.NumberFacilities; i++)
                {
                    writer.WriteLine(Assignment[i] + 1);
                }
            }
        }
 protected override double Fitness(int[] solution)
 {
     return(QAPUtils.Fitness(Instance, solution));
 }
Beispiel #4
0
 protected override double Fitness(int[] individual)
 {
     return(QAPUtils.Fitness(Instance, individual));
 }