Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Statistics tracking #22

Merged
merged 14 commits into from
Jul 30, 2022
Merged

Statistics tracking #22

merged 14 commits into from
Jul 30, 2022

Conversation

N-Wouda
Copy link
Owner

@N-Wouda N-Wouda commented Jul 28, 2022

Closes #21.

@N-Wouda
Copy link
Owner Author

N-Wouda commented Jul 28, 2022

@LiekevdHeide you can use this branch to add the statistics tracking stuff!

@N-Wouda
Copy link
Owner Author

N-Wouda commented Jul 28, 2022

Statistics now collection population data (pop size, # feasible), and new incumbent best solutions (when and value). Example:

image

using clock = std::chrono::system_clock;
using timedDatapoints = std::vector<std::pair<clock::time_point, double>>;

// TODO measure and store population diversity statistic?
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LiekevdHeide (and/or @leonlan): do you have any idea on how to measure population diversity?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you asking how it is currently measured (broken pairs distance) or are you asking whether we have other suggestions for measuring diversity?

Copy link
Owner Author

@N-Wouda N-Wouda Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latter, the former I already know about. I'm looking for some alternatives that we can quickly compute for the whole population, rather than using the broken pairs distance which is currently only computed for the neighbourhood defined by nbGranular.

Copy link
Collaborator

@leonlan leonlan Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could calculate broken pairs over the entire population if you ignore nbClose in Individual::avgBrokenPairDistanceClosest, no?

Prins (p. 36) also outlines three other measures for the giant tour chromosome: 1) Hamming, 2) Broken Pairs, and 3) Levenshtein distance. I think the Hamming distance might be interesting to try out. It's easy to compute, cheap (same time complexity as broken pairs, and for VRPTW does not have the drawback of "circular shifts" as stated in the slides.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add something like this and then I think this PR is done.

@N-Wouda N-Wouda self-assigned this Jul 28, 2022
Defaults to false, since we do not usually want to collect statistics. Also fix a rounding issue with the seconds/runtime calculation in the plots.
@N-Wouda
Copy link
Owner Author

N-Wouda commented Jul 29, 2022

With average diversity (avg broken pairs distance to nearest nbGranular neighbours) on a secondary y-axis:

image

@N-Wouda
Copy link
Owner Author

N-Wouda commented Jul 29, 2022

I think this is done. @LiekevdHeide @leonlan can you review this (hopefully today)?

@N-Wouda N-Wouda requested a review from leonlan July 29, 2022 09:00
@leonlan
Copy link
Collaborator

leonlan commented Jul 29, 2022

I think this is done. @LiekevdHeide @leonlan can you review this (hopefully today)?

I will review it today!

python/classes/Measures.py Outdated Show resolved Hide resolved
benchmark.py Outdated
@@ -8,6 +8,7 @@
from tqdm.contrib.concurrent import process_map

import tools
from python.classes import Measures


def parse_args():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: add argument --collect_statistics to make it optional.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: how should we evaluate a benchmark without statistics?

Copy link
Collaborator

@leonlan leonlan Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to benchmark solver on the average costs for the given competition time limits, then I don't see the need for collecting statistics. (Assuming that collecting statistics adds non-negligible computational overhead.)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's small, as in, I don't see a difference in solution quality with stats on/off ATM.

Two issues:

  • It's a hassle to make this optional, and I want to sleep. :-)
  • I already use these stats to make decisions on how well ideas work, in addition to just the average cost. E.g. the # iterations tells me whether the local search went faster/slower than previously, and similarly the # improving moves is useful in checking the algorithm actually does something for each instance.

Since the performance hit is miniscule, I do not yet see the need to remove collection from the benchmark script.

Copy link
Collaborator

@leonlan leonlan Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the performance hit is miniscule, then I don't see any issues here.

I didn't realize that measures/stats were coupled, so when reviewing I thought it would be an almost trivial addition. But I now understand your first point so I think it's bedtime for me :-)

benchmark.py Outdated Show resolved Hide resolved
python/classes/Measures.py Outdated Show resolved Hide resolved
hgs_vrptw/include/Statistics.h Show resolved Hide resolved
hgs_vrptw/include/Statistics.h Show resolved Hide resolved
hgs_vrptw/include/Result.h Show resolved Hide resolved
hgs_vrptw/include/Statistics.h Outdated Show resolved Hide resolved
@N-Wouda N-Wouda merged commit a58ca4c into main Jul 30, 2022
@N-Wouda N-Wouda deleted the track-statistics branch July 30, 2022 07:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking statistics on debug builds
2 participants