- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Implement this interface to implement the bias function used by HBSS. Specifically, when making a randomized decision among possible permutation elements to add to the permutation, HBSS choose randomly but biased by a function of the ranks that would result if we were to sort the elements in order by their heuristic values. If rank is the rank of permutation element e according to the heuristic, then e will be added to the permutation with a probability proportional to bias(rank). How you implement this depends upon how much confidence you have in the specific heuristic you are randomizing. Just make sure that you remember that the lowest rank, rank of 1, is the element perceived to be best by the heuristic. So the bias function must map lower ranks to higher values, and the output must be positive.
(int rank)This method is the bias function.
rank- The rank of one of the elements under consideration for addition to the permutation, where rank means position in a list of the elements if they were sorted by heuristic value.
- the bias function applied to that rank