private Position calculateBetaBest(Krill krill, HerdParameters parameters) { Position bestRelatedPosition = tendencyCalculator.calculateRelatedPosition(krill.getBestPosition(),krill.getPosition()); float bestFitness = tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(),krill.getBestPositionFitness(),parameters); //Debug.Log("best fitness " + bestFitness); bestRelatedPosition = bestRelatedPosition * bestFitness; return bestRelatedPosition; }
private float calculateSenseDistance(List<Krill> herd, Krill krill) { float distance = 0.0f; foreach(Krill other in herd){ distance += krill.getPosition().distanceFrom(other.getPosition()); } return distance/(5.0f * herd.Count); }
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; }
public void updateBestWorstKrill(Krill krill) { if(krill.getFitnessValue() < bestFitnessValue){ bestKrill = krill; bestFitnessValue = krill.getFitnessValue(); bestFitnessPosition = krill.getPosition().getClone(); } if(krill.getFitnessValue() > worstFitnessValue){ worstFitnessValue = krill.getFitnessValue(); } }
private float calculateSenseDistance(List <Krill> herd, Krill krill) { float distance = 0.0f; foreach (Krill other in herd) { distance += krill.getPosition().distanceFrom(other.getPosition()); } return(distance / (5.0f * herd.Count)); }
public void updateBestWorstKrill(Krill krill) { if (krill.getFitnessValue() < bestFitnessValue) { bestKrill = krill; bestFitnessValue = krill.getFitnessValue(); bestFitnessPosition = krill.getPosition().getClone(); } if (krill.getFitnessValue() > worstFitnessValue) { worstFitnessValue = krill.getFitnessValue(); } }
private Position calculateAlphaLocal(List<Krill> neighbours, Krill krill, HerdParameters parameters) { Position alphaLocal = new Position(); foreach (Krill neighbour in neighbours) { Position relatedPosition = tendencyCalculator.calculateRelatedPosition(neighbour.getPosition(), krill.getPosition()); float relatedFitness = tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(),neighbour.getFitnessValue(), parameters); relatedPosition = relatedPosition * relatedFitness; alphaLocal = alphaLocal + relatedPosition; } return alphaLocal; }
public List<Krill> determinateNeighbours(List<Krill> herd, Krill krill) { List<Krill> neighbours = new List<Krill>(); float senseDistance = calculateSenseDistance(herd,krill); foreach(Krill other in herd){ if(!(krill==other)){ float distance = krill.getPosition().distanceFrom(other.getPosition()); if(distance <= senseDistance){ neighbours.Add(other); } } } return neighbours; }
public List <Krill> determinateNeighbours(List <Krill> herd, Krill krill) { List <Krill> neighbours = new List <Krill>(); float senseDistance = calculateSenseDistance(herd, krill); foreach (Krill other in herd) { if (!(krill == other)) { float distance = krill.getPosition().distanceFrom(other.getPosition()); if (distance <= senseDistance) { neighbours.Add(other); } } } return(neighbours); }
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); }
private Position calculateAlphaLocal(List <Krill> neighbours, Krill krill, HerdParameters parameters) { Position alphaLocal = new Position(); foreach (Krill neighbour in neighbours) { Position relatedPosition = tendencyCalculator.calculateRelatedPosition(neighbour.getPosition(), krill.getPosition()); float relatedFitness = tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), neighbour.getFitnessValue(), parameters); relatedPosition = relatedPosition * relatedFitness; alphaLocal = alphaLocal + relatedPosition; } return(alphaLocal); }
public int getVerticalInput() { bestKrill = herd.simulate(); return(angleDirection(bestKrill.getPosition().toVector3())); }
public int getVerticalInput() { bestKrill = herd.simulate(); return angleDirection(bestKrill.getPosition().toVector3()); }
private Position calculateBetaBest(Krill krill, HerdParameters parameters) { Position bestRelatedPosition = tendencyCalculator.calculateRelatedPosition(krill.getBestPosition(), krill.getPosition()); float bestFitness = tendencyCalculator.calculateRelatedFitness(krill.getFitnessValue(), krill.getBestPositionFitness(), parameters); //Debug.Log("best fitness " + bestFitness); bestRelatedPosition = bestRelatedPosition * bestFitness; return(bestRelatedPosition); }