Branch: Tag:

2019-03-24

2019-03-24 18:13:48 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Calendar.mkexpert: Changed selection heuristic.

Prefer a wide split to a shallow split.

This gives an expert tree closer to the original.

136:    mapping(int:array(object)) histogram = mkhistogram(zones, times[l]);    int score = max(0, @map(values(histogram), sizeof));    int split = sizeof(histogram); -  if ((score < best_score) || -  ((score == best_score) && (split > best_split))) { +  if ((split > best_split) || +  ((split == best_split) && (score < best_score))) {    best_score = score;    best_split = split;    best_t = times[l];
159:    mapping(int:array(object)) histogram = mkhistogram(zones, times[l]);    int score = max(0, @map(values(histogram), sizeof));    int split = sizeof(histogram); -  if ((score < best_score) || -  ((score == best_score) && (split > best_split))) { +  if ((split > best_split) || +  ((split == best_split) && (score < best_score))) {    best_score = score;    best_split = split;    best_t = times[l];