示例#1
0
 public void crossoverHerd(List<Krill> herd, HerdParameters parameters)
 {
     foreach (Krill krill in herd) {
         float Cr = 0.2f * tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), parameters.getBestFitnessValue(), parameters);
         float ran = Random.Range(0.0f,1.0f);
         if (ran < Cr) {
             crossKrill(krill, herd);
         }
     }
 }
示例#2
0
    private Position calculateAlphaTarget(HerdParameters parameters, Krill krill)
    {
        Position relatedPosition = tendencyCalculator.calculateRelatedPosition(parameters.getBestFitnessPosition(), krill.getPosition());
        float relatedFitness = tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(),parameters.getBestFitnessValue(), parameters);

           	relatedPosition = relatedPosition * relatedFitness;
        relatedPosition = relatedPosition * calculateCoefficient(parameters);

        return relatedPosition;
    }
示例#3
0
    public void mutateHerd(List<Krill> herd, HerdParameters parameters)
    {
        foreach (Krill krill in herd) {
            float Mu = 0.05f / tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), parameters.getBestFitnessValue(), parameters);
            float ran = Random.Range(0.0f,1.0f);

            if (ran < Mu) {
                mutateKrill(krill, herd, parameters);
            }
        }
    }
示例#4
0
 public void crossoverHerd(List <Krill> herd, HerdParameters parameters)
 {
     foreach (Krill krill in herd)
     {
         float Cr  = 0.2f * tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), parameters.getBestFitnessValue(), parameters);
         float ran = Random.Range(0.0f, 1.0f);
         if (ran < Cr)
         {
             crossKrill(krill, herd);
         }
     }
 }
示例#5
0
    private Position calculateAlphaTarget(HerdParameters parameters, Krill krill)
    {
        Position relatedPosition = tendencyCalculator.calculateRelatedPosition(parameters.getBestFitnessPosition(), krill.getPosition());
        float    relatedFitness  = tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), parameters.getBestFitnessValue(), parameters);

        relatedPosition = relatedPosition * relatedFitness;
        relatedPosition = relatedPosition * calculateCoefficient(parameters);

        return(relatedPosition);
    }
示例#6
0
    public void mutateHerd(List <Krill> herd, HerdParameters parameters)
    {
        foreach (Krill krill in herd)
        {
            float Mu  = 0.05f / tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), parameters.getBestFitnessValue(), parameters);
            float ran = Random.Range(0.0f, 1.0f);

            if (ran < Mu)
            {
                mutateKrill(krill, herd, parameters);
            }
        }
    }