Research Article

Autonomic Obstacle Detection and Avoidance in MANETs Driven by Cartography Enhanced OLSR

Algorithm 2

Filtering procedure.
Require:
    PrunedList: a list of obstacle information (OI) resulting fom the pruning step.
    : Local density radius.
    percentageOfObstInfToBeFiltered: percentage of OI to be filtered out.
Ensure: FilteredList: a list containing the kept points (positions).
      ▹ convert the list of position pairs (OI) to a list of positions (points)
()    LP: List                       ▹  list of points
()    for each  obstacleInformation   in  PrunedList  do
()      .Add(.LeftExtremity)
()      .Add(.RightExtremity)
()    end  for
         ▹  For each point we calculate its local density (i.e. the number of points (neighbours) whose distance
    with the current point is less than
()    nbOfNeighbours[.size] ▹  array in which we save the local density of each point
()    for  (; .size; )  do
()    nbOfNeighbours[]  0
()    end for
() maxDensity  0
() for  (; .size; )  do
()    for  (; .size; )  do
()      if  (euclidianDistance([], []) < )  then
()       nbOfNeighbours[]++
()      end if
()    end for
(17)    if  (nbOfNeighbours[] > maxDensity)  then
()     maxDensity  nbOfNeighbours[]
()    end if
() end for
() locDensHist[maxDensity + 1]  ▹  an array in which we will calculate the local density histogram
() for  (; ≤ locDensHist.size; )  do
()   locDensHist[]  0
() end for
() for  (; .size; )  do
()   locDensHist[nbOfNeighbours[]]++
() end for
() nbOfObstacleInformationToBeFiltered .size/100 percentageOfObstInfToBeFiltered
() sumOfObstInf  0
() localDensityThreshold  positiveInfinity
() for  (; ≤ locDensHist.size; )  do
()   sumOfObstInf += localDensityHistogram[]
()    if  (sumOfObstInf > nbOfObstacleInformationToBeFiltered)  then
()     localDensityThreshold 
()     break                     ▹  leave the loop
()    end if
() end for
() FilteredList: List
() for  (; .size; )  do
()    if  (nbOfNeighbours[] ≥ localDensityThreshold)  then
()     FilteredList.Add([])
()    end if
() end for
() return  FilteredList