pattern_search: calculate difference between new best score and previous best score. read_weight_scores: cast weights to tuple.