#include <LinkScheduleEstimator.h>
Inheritance diagram for dtn::LinkScheduleEstimator:
.. ,(startN, durationN), the LinkScheduleEstimator algorithm figures out a periodic schedule that this log conforms to.
The schedule computed can then be used to predict future link-up events, and to inform far-away nodes about the future predicted availability of the link in question.
Usage: Log* find_schedule(Log* log);
Returns the best schedule for the given log. If there's no discernible periodicity in the log, the return value will be NULL.
Definition at line 46 of file LinkScheduleEstimator.h.
Public Types | |
typedef std::vector< LogEntry > | Log |
Public Member Functions | |
LinkScheduleEstimator () | |
Static Public Member Functions | |
static Log * | find_schedule (Log *log) |
Private Member Functions | |
unsigned int | entry_dist (Log &a, unsigned int a_index, unsigned int a_offset, Log &b, unsigned int b_index, unsigned int b_offset, unsigned int warping_window) |
unsigned int | log_dist_r (Log &a, unsigned int a_index, unsigned int a_offset, Log &b, unsigned int b_index, unsigned int b_offset, unsigned int warping_window) |
unsigned int | log_dist (Log &a, unsigned int a_offset, Log &b, unsigned int b_offset, unsigned int warping_window, int print_table) |
unsigned int | autocorrelation (Log &log, unsigned int phase, int print_table) |
void | print_log (Log &log, int relative_dates) |
Log * | generate_samples (Log &schedule, unsigned int log_size, unsigned int start_jitter, double duration_jitter) |
unsigned int | estimate_period (Log &log) |
unsigned int | seek_to_before_date (Log &log, unsigned int date) |
return the index of the closest log entry at or before the given date. | |
unsigned int | closest_entry_to_date (Log &log, unsigned int date) |
return the index of the closest log entry to the given date | |
Log * | clone_subsequence (Log &log, unsigned int start, unsigned int len) |
unsigned int | badness_of_match (Log &pattern, Log &log, unsigned int warping_window, unsigned int period) |
Log * | extract_schedule (Log &log, unsigned int period_estimate) |
unsigned int | refine_period (Log &log, unsigned int period_estimate) |
Log * | find_schedule (Log &log) |
This is the function to be called from the outside. | |
Classes | |
struct | LogEntry |
typedef std::vector<LogEntry> dtn::LinkScheduleEstimator::Log |
Definition at line 53 of file LinkScheduleEstimator.h.
dtn::LinkScheduleEstimator::LinkScheduleEstimator | ( | ) |
Definition at line 31 of file LinkScheduleEstimator.cc.
unsigned int dtn::LinkScheduleEstimator::entry_dist | ( | Log & | a, | |
unsigned int | a_index, | |||
unsigned int | a_offset, | |||
Log & | b, | |||
unsigned int | b_index, | |||
unsigned int | b_offset, | |||
unsigned int | warping_window | |||
) | [private] |
Definition at line 44 of file LinkScheduleEstimator.cc.
References absdiff.
Referenced by log_dist(), and log_dist_r().
unsigned int dtn::LinkScheduleEstimator::log_dist_r | ( | Log & | a, | |
unsigned int | a_index, | |||
unsigned int | a_offset, | |||
Log & | b, | |||
unsigned int | b_index, | |||
unsigned int | b_offset, | |||
unsigned int | warping_window | |||
) | [private] |
Definition at line 59 of file LinkScheduleEstimator.cc.
References dtn::dist, entry_dist(), and MAX_DIST.
Referenced by log_dist().
unsigned int dtn::LinkScheduleEstimator::log_dist | ( | Log & | a, | |
unsigned int | a_offset, | |||
Log & | b, | |||
unsigned int | b_offset, | |||
unsigned int | warping_window, | |||
int | print_table | |||
) | [private] |
Definition at line 108 of file LinkScheduleEstimator.cc.
References dtn::dist, entry_dist(), log_debug, log_dist_r(), and MAX_DIST.
Referenced by autocorrelation(), and badness_of_match().
unsigned int dtn::LinkScheduleEstimator::autocorrelation | ( | Log & | log, | |
unsigned int | phase, | |||
int | print_table | |||
) | [private] |
Definition at line 170 of file LinkScheduleEstimator.cc.
References log_dist(), and WARPING_WINDOW.
Referenced by estimate_period().
void dtn::LinkScheduleEstimator::print_log | ( | Log & | log, | |
int | relative_dates | |||
) | [private] |
Definition at line 195 of file LinkScheduleEstimator.cc.
References log_debug.
Referenced by extract_schedule().
LinkScheduleEstimator::Log * dtn::LinkScheduleEstimator::generate_samples | ( | Log & | schedule, | |
unsigned int | log_size, | |||
unsigned int | start_jitter, | |||
double | duration_jitter | |||
) | [private] |
Definition at line 215 of file LinkScheduleEstimator.cc.
unsigned int dtn::LinkScheduleEstimator::estimate_period | ( | Log & | log | ) | [private] |
Definition at line 263 of file LinkScheduleEstimator.cc.
References absdiff, autocorrelation(), and PERIOD_TOLERANCE.
Referenced by find_schedule().
unsigned int dtn::LinkScheduleEstimator::seek_to_before_date | ( | Log & | log, | |
unsigned int | date | |||
) | [private] |
return the index of the closest log entry at or before the given date.
Definition at line 294 of file LinkScheduleEstimator.cc.
Referenced by closest_entry_to_date().
unsigned int dtn::LinkScheduleEstimator::closest_entry_to_date | ( | Log & | log, | |
unsigned int | date | |||
) | [private] |
return the index of the closest log entry to the given date
Definition at line 306 of file LinkScheduleEstimator.cc.
References absdiff, and seek_to_before_date().
Referenced by badness_of_match(), extract_schedule(), and refine_period().
LinkScheduleEstimator::Log * dtn::LinkScheduleEstimator::clone_subsequence | ( | Log & | log, | |
unsigned int | start, | |||
unsigned int | len | |||
) | [private] |
Definition at line 320 of file LinkScheduleEstimator.cc.
Referenced by badness_of_match(), and extract_schedule().
unsigned int dtn::LinkScheduleEstimator::badness_of_match | ( | Log & | pattern, | |
Log & | log, | |||
unsigned int | warping_window, | |||
unsigned int | period | |||
) | [private] |
Definition at line 336 of file LinkScheduleEstimator.cc.
References change, clone_subsequence(), closest_entry_to_date(), and log_dist().
Referenced by extract_schedule().
LinkScheduleEstimator::Log * dtn::LinkScheduleEstimator::extract_schedule | ( | Log & | log, | |
unsigned int | period_estimate | |||
) | [private] |
Definition at line 368 of file LinkScheduleEstimator.cc.
References badness_of_match(), clone_subsequence(), closest_entry_to_date(), log_debug, pattern(), print_log(), and WARPING_WINDOW.
Referenced by find_schedule().
unsigned int dtn::LinkScheduleEstimator::refine_period | ( | Log & | log, | |
unsigned int | period_estimate | |||
) | [private] |
Definition at line 468 of file LinkScheduleEstimator.cc.
References closest_entry_to_date(), and count.
Referenced by find_schedule().
LinkScheduleEstimator::Log * dtn::LinkScheduleEstimator::find_schedule | ( | Log & | log | ) | [private] |
This is the function to be called from the outside.
Definition at line 493 of file LinkScheduleEstimator.cc.
References estimate_period(), extract_schedule(), and refine_period().