Example #1
0
  protected ArrayList<WeightedCell> evaluate() {
    double myPositionValue = getStaticFFValue(position);
    double neighbourValue;
    double occupation = 0.0;
    double probabilitySum = 0.0;

    Neighbourhood neighbourhood = getNeighbourhood();
    ArrayList<WeightedCell> probabilityValues = new ArrayList<WeightedCell>();

    for (int index = 0; index < neighbourhood.size(); index++) {
      GridPoint neighbour = neighbourhood.get(index);
      neighbourValue = getStaticFFValue(neighbour);

      occupation = 0.0;
      if ((!neighbour.equals(position)) && checkOccupancy(neighbour)) occupation = 1.0;

      double p = utilityFunction(myPositionValue, neighbourValue, occupation);

      probabilitySum += p;
      probabilityValues.add(new WeightedCell(neighbour, p));
    }
    Lottery.normalizeProbabilities(probabilityValues, probabilitySum);
    return probabilityValues;
  }