示例#1
0
 public static bool betterFitness(Individual bestSol, Individual newBestSol)
 {
     if (bestSol.getFitness() != double.Epsilon)
     {
         if (FitnessCalc._op == Operation.Max)
         {
             return(bestSol.getFitness() <= newBestSol.getFitness());
         }
         else
         {
             return(bestSol.getFitness() >= newBestSol.getFitness());
         }
     }
     else
     {
         return(false);
     }
 }
示例#2
0
 private static bool betterFitness(Individual fittest, int i)
 {
     if (fittest.getFitness() != double.Epsilon)
     {
         if (_op == Operation.Max)
         {
             return(fittest.getFitness() <= currentPopulation.getIndividual(i).getFitness());
         }
         else
         {
             return(fittest.getFitness() >= currentPopulation.getIndividual(i).getFitness());
         }
     }
     else
     {
         return(false);
     }
 }
示例#3
0
 public static double getProb(Individual individual)
 {
     if (individual.getFitness() != double.Epsilon)
     {
         double prob = individual.getFitness() / _sumPopulationFitness;
         if (_op == Operation.Max)
         {
             return(prob);
         }
         else
         {
             return(1 - prob);
         }
     }
     else
     {
         return(0.0);
     }
 }
示例#4
0
 public static double getProb(Individual individual)
 {
     if(individual.getFitness() != double.Epsilon) {
         double prob = individual.getFitness() / _sumPopulationFitness;
         if (_op == Operation.Max) {
             return prob;
         } else {
             return (1 - prob);
         }
     } else {
         return 0.0;
     }
 }
示例#5
0
 public static double getExpectedCount(Individual individual)
 {
     double expectedCount = individual.getFitness() / _avgPopulationFitness;
     return expectedCount;
 }
示例#6
0
 private static bool betterFitness(Individual fittest, int i)
 {
     if (fittest.getFitness() != double.Epsilon) {
         if (_op == Operation.Max) {
             return fittest.getFitness() <= currentPopulation.getIndividual(i).getFitness();
         } else {
             return fittest.getFitness() >= currentPopulation.getIndividual(i).getFitness();
         }
     } else { return false; }
 }
示例#7
0
        public static double getExpectedCount(Individual individual)
        {
            double expectedCount = individual.getFitness() / _avgPopulationFitness;

            return(expectedCount);
        }
示例#8
0
 public static bool betterFitness(Individual bestSol, Individual newBestSol)
 {
     if (bestSol.getFitness() != double.Epsilon) {
         if (FitnessCalc._op == Operation.Max) {
             return bestSol.getFitness() <= newBestSol.getFitness();
         } else {
             return bestSol.getFitness() >= newBestSol.getFitness();
         }
     } else { return false; }
 }