Function compute_choosen_index

Function Documentation

unsigned short int compute_choosen_index(unsigned short int attractive_index, const std::vector<std::pair<unsigned short int, float>> &local_minima, bool use_minima_near_attractive)

Computes the chosen index based on the attractive index and local minima.

This function selects an index based on the given attractive index and a list of local minima. It can either choose the closest local minima to the attractive index or the global minimum based on the user’s preference.

Parameters:
  • attractive_index – The index that is considered attractive.

  • local_minima – A vector of pairs where each pair consists of an index and its corresponding value.

  • use_minima_near_attractive – A boolean flag indicating whether to use the closest local minima to the attractive index. If true, the closest local minima to the attractive index is chosen. If false, the global minimum is chosen.

Returns:

The chosen index based on the given criteria.