LinkScheduleEstimator.h

Go to the documentation of this file.
00001 #include <vector>
00002 #include <oasys/util/IntUtils.h>
00003 #include <oasys/debug/Log.h>
00004 
00005 #define CONTACT(s, d) { s, d }
00006 #define absdiff(x,y) ((x<y)?((y)-(x)):((x)-(y)))
00007 
00008 #define WARPING_WINDOW .02
00009 #define PERIOD_TOLERANCE .02
00010 #define MAX_DIST 1<<30
00011 
00012 namespace dtn {
00013     
00030 class LinkScheduleEstimator : public oasys::Logger {
00031 public:
00032     typedef struct {
00033       unsigned int start;
00034       unsigned int duration;
00035     } LogEntry;
00036     
00037     typedef std::vector<LogEntry> Log;
00038     
00039     static Log* find_schedule(Log* log);
00040 
00041     LinkScheduleEstimator();
00042 private:
00043     unsigned int entry_dist(Log &a, unsigned int a_index, unsigned int a_offset,
00044                             Log &b, unsigned int b_index, unsigned int b_offset,
00045                             unsigned int warping_window);
00046 
00047     unsigned int log_dist_r(Log &a, unsigned int a_index, unsigned int a_offset,
00048                             Log &b, unsigned int b_index, unsigned int b_offset,
00049                             unsigned int warping_window);
00050     
00051        
00052     unsigned int log_dist(Log &a, unsigned int a_offset,
00053                  Log &b, unsigned int b_offset,
00054                  unsigned int warping_window, int print_table);
00055     
00056     unsigned int autocorrelation(Log &log, unsigned int phase, int print_table);    
00057     void print_log(Log &log, int relative_dates);
00058     
00059     Log* generate_samples(Log &schedule,
00060                           unsigned int log_size,
00061                           unsigned int start_jitter,
00062                           double duration_jitter);
00063     
00064     unsigned int estimate_period(Log &log);       
00065     unsigned int seek_to_before_date(Log &log, unsigned int date);                
00066     unsigned int closest_entry_to_date(Log &log, unsigned int date);
00067     Log* clone_subsequence(Log &log, unsigned int start, unsigned int len);
00068         
00069     unsigned int badness_of_match(Log &pattern,
00070                                   Log &log,
00071                                   unsigned int warping_window, 
00072                                   unsigned int period);
00073     
00074     Log* extract_schedule(Log &log, unsigned int period_estimate);    
00075     unsigned int refine_period(Log &log, unsigned int period_estimate);
00076     Log* find_schedule(Log &log);    
00077 };
00078 
00079 
00080 }

Generated on Fri Dec 22 14:47:59 2006 for DTN Reference Implementation by  doxygen 1.5.1