-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.interfaces.LinkingRule,java.io.Serializable
public class ClosestN<T, P extends Position<P>> implements LinkingRule<T, P>
Non local-consistent rule that connect the closest N nodes together. Two nodes get connected if either one belongs to the set of the ten devices closest to the other.
-
-
Method Summary
Modifier and Type Method Description final Neighborhood<T>computeNeighborhood(Node<T> center, Environment<T, P> environment)final booleanisLocallyConsistent()-
-
Constructor Detail
-
ClosestN
ClosestN(int n, int expectedNodes, int maxNodes)
- Parameters:
n- neighborsexpectedNodes- how many nodes are expected to be inserted in the environment (used for optimization)maxNodes- the maximum number of nodes for which the connection range will be cached
-
ClosestN
ClosestN(int n, int expectedNodes)
- Parameters:
n- neighborsexpectedNodes- how many nodes are expected to be inserted in the environment (used for optimization)
-
ClosestN
ClosestN(int n)
- Parameters:
n- neighbors
-
-
Method Detail
-
computeNeighborhood
final Neighborhood<T> computeNeighborhood(Node<T> center, Environment<T, P> environment)
-
isLocallyConsistent
final boolean isLocallyConsistent()
-
-
-
-