Function computeChoosenIndex
Defined in File potential_pursuit.hpp
Function Documentation
-
unsigned short int computeChoosenIndex(unsigned short int preferredIndex, const std::vector<std::pair<unsigned short int, float>> &localMinima)
Computes the chosen index based on the preferred index and a list of local minima. If the list of local minima is empty, the preferred index is returned. Otherwise, the index with the smallest value in the local minima list is returned.
- Parameters:
preferredIndex – The preferred index.
localMinima – A vector of pairs representing the local minima, where the first element is the index and the second element is the value.
- Returns:
The chosen index.