Class NearestNeighborCommunicator

All Implemented Interfaces:
SimulationListener

public class NearestNeighborCommunicator extends Communicator
  • Constructor Details

    • NearestNeighborCommunicator

      public NearestNeighborCommunicator(Simulation simulation, int numNeighbors)
  • Method Details

    • getExpectedRecipients

      public List<MessageListener> getExpectedRecipients(Message message)
      Specified by:
      getExpectedRecipients in class Communicator
    • findNearestNeighbors

      public List<Pair<MessageListener,Double>> findNearestNeighbors(HasGridPosition fromAgent)
      This calculates the distance between agents based on each agent's knowledge of its location. Instead, you might want to calculate the distance based on what each agent *THINKS* its distance is from other agents. That will require that the calculation uses the fromAgent's internal knowledge rather than the agent data from the simulation.
      Parameters:
      fromAgent -
      Returns: