Crossings Minimization  1.0
stats.h
Go to the documentation of this file.
1 /**
2  * @file stats.h
3  * @brief Functions for reporting various statistics about the graph and the
4  * outcomes.
5  * @author Matthias Stallmann
6  * @date 2009/05/19
7  * $Id: stats.h 12 2011-06-17 22:00:01Z mfms $
8  */
9 
10 #ifndef STATS_H
11 #define STATS_H
12 
13 #include<stdio.h>
14 #include<stdbool.h>
15 
16 #include"order.h"
17 
18 typedef struct crossing_stats_int {
23  int best;
27  const char * name;
29 
30 typedef struct crossing_stats_double {
31  double at_beginning;
35  double best;
36  double previous_best;
39  const char * name;
41 
47 
48 /**
49  * Initializes crossing stats structures
50  */
51 void init_crossing_stats( void );
52 
53 /**
54  * Saves statistics about crossings before run for later printing
55  */
56 void capture_beginning_stats( void );
57 
58 /**
59  * Saves statistics about crossings after preprocessing for later printing
60  */
61 void capture_preprocessing_stats( void );
62 
63 /**
64  * Saves statistics about crossings after the main heuristic has completed
65  * for later printing
66  * <em>Assumes that the best heuristic iteration has already been saved and
67  * the best heuristic ordering has been restored.</em>
68  */
69 void capture_heuristic_stats( void );
70 
71 /**
72  * Saves statistics about crossings after post processing for later printing
73  */
75 
76 /**
77  * Updates the best value if needed, usually at the end of an iteration
78  * @param stats the stats struct to be updated
79  * @param order the order that needs to be captured when the best is updated
80  * @param crossing_retrieval_function function that returns the current
81  * value -- to be compared to the best value
82  */
83 void update_best_int( CROSSING_STATS_INT * stats, Orderptr order,
84  int (* crossing_retrieval_function) (void) );
85 
86 /**
87  * Updates the best value if needed, usually at the end of an iteration
88  * @param stats the stats struct to be updated
89  * @param order the order that needs to be captured when the best is updated
90  * @param crossing_retrieval_function function that returns the current
91  * value -- to be compared to the best value
92  */
94  double (* crossing_retrieval_function) (void) );
95 
96 /**
97  * Updates the best value of all stats if needed, i.e., calls update_best on
98  * all stats
99  */
100 void update_best_all( void );
101 
102 /**
103  * @return true if stats.best has improved since the last time this function
104  * was called
105  *
106  * <em>Side effect</e> stats.previous_best is updated
107  */
108 bool has_improved_int( CROSSING_STATS_INT * stats );
109 
110 /**
111  * @return true if stats.best has improved since the last time this function
112  * was called
113  *
114  * <em>Side effect</e> stats.previous_best is updated
115  */
117 
118 /**
119  * Print statistics that are intrinsic to the graph, independent of any
120  * heuristics
121  */
122 void print_graph_statistics( FILE * output_stream );
123 
124 /**
125  * Print statistics that document the results of the heuristic just completed
126  */
127 void print_run_statistics( FILE * output_stream );
128 
129 #endif
130 
131 /* [Last modified: 2016 05 18 at 19:59:14 GMT] */
const char * name
Definition: stats.h:39
double after_preprocessing
Definition: stats.h:32
void print_run_statistics(FILE *output_stream)
Definition: stats.c:532
struct crossing_stats_double CROSSING_STATS_DOUBLE
int after_post_processing
Definition: stats.h:22
void update_best_all(void)
Definition: stats.c:281
void update_best_double(CROSSING_STATS_DOUBLE *stats, Orderptr order, double(*crossing_retrieval_function)(void))
Definition: stats.c:263
double at_beginning
Definition: stats.h:31
void print_graph_statistics(FILE *output_stream)
Definition: stats.c:485
const char * name
Definition: stats.h:27
CROSSING_STATS_INT favored_edge_crossings
Definition: stats.c:149
double previous_best
Definition: stats.h:36
int after_preprocessing
Definition: stats.h:20
bool has_improved_int(CROSSING_STATS_INT *stats)
Definition: stats.c:309
CROSSING_STATS_DOUBLE total_stretch
Definition: stats.c:150
int previous_best
Definition: stats.h:24
int best_heuristic_iteration
Definition: stats.h:37
int after_heuristic
Definition: stats.h:21
CROSSING_STATS_INT total_crossings
Definition: stats.c:147
CROSSING_STATS_DOUBLE bottleneck_stretch
Definition: stats.c:151
int post_processing_iteration
Definition: stats.h:26
void capture_post_processing_stats(void)
Definition: stats.c:228
int post_processing_iteration
Definition: stats.h:38
void capture_preprocessing_stats(void)
Definition: stats.c:206
data structure and function headers for saving/restoring order information.
struct crossing_stats_int CROSSING_STATS_INT
void capture_beginning_stats(void)
Definition: stats.c:195
void capture_heuristic_stats(void)
Definition: stats.c:217
bool has_improved_double(CROSSING_STATS_DOUBLE *stats)
Definition: stats.c:327
double after_post_processing
Definition: stats.h:34
double after_heuristic
Definition: stats.h:33
void update_best_int(CROSSING_STATS_INT *stats, Orderptr order, int(*crossing_retrieval_function)(void))
Definition: stats.c:245
CROSSING_STATS_INT max_edge_crossings
Definition: stats.c:148
int at_beginning
Definition: stats.h:19
int best_heuristic_iteration
Definition: stats.h:25
void init_crossing_stats(void)
Definition: stats.c:182