Crossings Minimization  1.0
stats.c File Reference

Implementation of functions that print statistics. More...

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
#include <float.h>
#include "stats.h"
#include "defs.h"
#include "heuristics.h"
#include "graph.h"
#include "min_crossings.h"
#include "crossings.h"
#include "channel.h"
#include "priority_edges.h"
#include "Statistics.h"
#include "timing.h"
Include dependency graph for stats.c:

Go to the source code of this file.

Data Structures

struct  pareto_item
 

Typedefs

typedef struct pareto_itemPARETO_LIST
 

Functions

static void init_pareto_list (void)
 
static void print_pareto_list (PARETO_LIST list, FILE *output_stream)
 
static PARETO_LIST pareto_insert (double objective_one, double objective_two, int iteration, PARETO_LIST list)
 
static void init_specific_crossing_stats_int (CROSSING_STATS_INT *stats, const char *name)
 
static void init_specific_crossing_stats_double (CROSSING_STATS_DOUBLE *stats, const char *name)
 
void init_crossing_stats (void)
 
void capture_beginning_stats (void)
 
void capture_preprocessing_stats (void)
 
void capture_heuristic_stats (void)
 
void capture_post_processing_stats (void)
 
void update_best_int (CROSSING_STATS_INT *stats, Orderptr order, int(*crossing_retrieval_function)(void))
 
void update_best_double (CROSSING_STATS_DOUBLE *stats, Orderptr order, double(*crossing_retrieval_function)(void))
 
void update_best_all (void)
 
bool has_improved_int (CROSSING_STATS_INT *stats)
 
bool has_improved_double (CROSSING_STATS_DOUBLE *stats)
 
static int total_layer_degree (int layer)
 
static void add_layer_degrees (int layer, Statistics s)
 
static void print_layer_degree_statistics (int layer, FILE *output_stream)
 
static void print_channel_degree_statistics (FILE *output_stream)
 
static void print_channel_edge_counts (FILE *output_stream)
 
static void compute_degree_statistics (void)
 
static void print_degree_statistics (FILE *output_stream)
 
void print_graph_statistics (FILE *output_stream)
 
static void print_crossing_stats_int (FILE *output_stream, CROSSING_STATS_INT stats)
 
static void print_crossing_stats_double (FILE *output_stream, CROSSING_STATS_DOUBLE stats)
 
void print_run_statistics (FILE *output_stream)
 

Variables

static PARETO_LIST pareto_list = NULL
 
CROSSING_STATS_INT total_crossings
 
CROSSING_STATS_INT max_edge_crossings
 
CROSSING_STATS_INT favored_edge_crossings
 
CROSSING_STATS_DOUBLE total_stretch
 
CROSSING_STATS_DOUBLE bottleneck_stretch
 
Statistics overall_degree
 

Detailed Description

Implementation of functions that print statistics.

Author
Matt Stallmann
Date
2009/05/19
Todo:
To keep things simple, total stretch is rounded to an integer value
Id
stats.c 131 2016-01-12 01:07:39Z mfms

Definition in file stats.c.

Typedef Documentation

◆ PARETO_LIST

typedef struct pareto_item * PARETO_LIST

Function Documentation

◆ add_layer_degrees()

static void add_layer_degrees ( int  layer,
Statistics  s 
)
static

Definition at line 357 of file stats.c.

References add_data(), DEGREE, layers, layer_struct::nodes, and layer_struct::number_of_nodes.

Referenced by print_degree_statistics().

Here is the call graph for this function:

◆ capture_beginning_stats()

void capture_beginning_stats ( void  )

Saves statistics about crossings before run for later printing

Definition at line 195 of file stats.c.

References crossing_stats_int::at_beginning, crossing_stats_double::at_beginning, maxEdgeCrossings(), maxEdgeStretch(), numberOfCrossings(), priorityEdgeCrossings(), and totalStretch().

Referenced by main().

Here is the call graph for this function:

◆ capture_heuristic_stats()

void capture_heuristic_stats ( void  )

Saves statistics about crossings after the main heuristic has completed for later printing Assumes that the best heuristic iteration has already been saved and the best heuristic ordering has been restored.

Definition at line 217 of file stats.c.

References crossing_stats_int::after_heuristic, crossing_stats_double::after_heuristic, crossing_stats_int::best, and crossing_stats_double::best.

Referenced by main().

◆ capture_post_processing_stats()

void capture_post_processing_stats ( void  )

◆ capture_preprocessing_stats()

void capture_preprocessing_stats ( void  )

Saves statistics about crossings after preprocessing for later printing

Definition at line 206 of file stats.c.

References crossing_stats_int::after_preprocessing, crossing_stats_double::after_preprocessing, maxEdgeCrossings(), maxEdgeStretch(), numberOfCrossings(), priorityEdgeCrossings(), and totalStretch().

Referenced by main().

Here is the call graph for this function:

◆ compute_degree_statistics()

static void compute_degree_statistics ( void  )
static

Definition at line 440 of file stats.c.

References add_data(), DEGREE, layers, layer_struct::nodes, number_of_layers, and layer_struct::number_of_nodes.

Referenced by print_graph_statistics().

Here is the call graph for this function:

◆ has_improved_double()

bool has_improved_double ( CROSSING_STATS_DOUBLE stats)
Returns
true if stats.best has improved since the last time this function was called

Side effect</e> stats.previous_best is updated

Definition at line 327 of file stats.c.

References crossing_stats_double::best, pareto_item::iteration, crossing_stats_double::name, and crossing_stats_double::previous_best.

Referenced by no_improvement().

◆ has_improved_int()

bool has_improved_int ( CROSSING_STATS_INT stats)
Returns
true if stats.best has improved since the last time this function was called

Side effect</e> stats.previous_best is updated

Definition at line 309 of file stats.c.

References crossing_stats_int::best, pareto_item::iteration, crossing_stats_int::name, and crossing_stats_int::previous_best.

Referenced by no_improvement().

◆ init_crossing_stats()

void init_crossing_stats ( void  )

Initializes crossing stats structures

Definition at line 182 of file stats.c.

References init_pareto_list(), init_specific_crossing_stats_double(), init_specific_crossing_stats_int(), NO_PARETO, and pareto_objective.

Referenced by main().

Here is the call graph for this function:

◆ init_pareto_list()

static void init_pareto_list ( void  )
static

Definition at line 38 of file stats.c.

Referenced by init_crossing_stats().

◆ init_specific_crossing_stats_double()

◆ init_specific_crossing_stats_int()

◆ pareto_insert()

static PARETO_LIST pareto_insert ( double  objective_one,
double  objective_two,
int  iteration,
PARETO_LIST  list 
)
static

Inserts, if appropriate, an item with the given values of objective_one and and objective_two into the list representing a Pareto frontier. The frontier is maintained in increasing objective_one, decreasing objective_two order.

Definition at line 75 of file stats.c.

References pareto_item::iteration, pareto_item::objective_one, pareto_item::objective_two, print_pareto_list(), and pareto_item::rest.

Referenced by update_best_all().

Here is the call graph for this function:

◆ print_channel_degree_statistics()

static void print_channel_degree_statistics ( FILE *  output_stream)
static

◆ print_channel_edge_counts()

static void print_channel_edge_counts ( FILE *  output_stream)
static

◆ print_crossing_stats_double()

◆ print_crossing_stats_int()

◆ print_degree_statistics()

static void print_degree_statistics ( FILE *  output_stream)
static

◆ print_graph_statistics()

void print_graph_statistics ( FILE *  output_stream)

◆ print_layer_degree_statistics()

static void print_layer_degree_statistics ( int  layer,
FILE *  output_stream 
)
static

Definition at line 368 of file stats.c.

References add_data(), DEGREE, free_statistics(), init_statistics(), layers, layer_struct::nodes, layer_struct::number_of_nodes, and print_statistics().

Referenced by print_degree_statistics().

Here is the call graph for this function:

◆ print_pareto_list()

static void print_pareto_list ( PARETO_LIST  list,
FILE *  output_stream 
)
static

◆ print_run_statistics()

void print_run_statistics ( FILE *  output_stream)

Print statistics that document the results of the heuristic just completed

Definition at line 532 of file stats.c.

References heuristic, pareto_item::iteration, NO_PARETO, pareto_objective, preprocessor, print_crossing_stats_double(), print_crossing_stats_int(), print_pareto_list(), and RUNTIME.

Referenced by main().

Here is the call graph for this function:

◆ total_layer_degree()

static int total_layer_degree ( int  layer)
static

Definition at line 345 of file stats.c.

References DEGREE, layers, layer_struct::nodes, and layer_struct::number_of_nodes.

Referenced by print_degree_statistics().

◆ update_best_all()

void update_best_all ( void  )

◆ update_best_double()

void update_best_double ( CROSSING_STATS_DOUBLE stats,
Orderptr  order,
double(*)(void)  crossing_retrieval_function 
)

Updates the best value if needed, usually at the end of an iteration

Parameters
statsthe stats struct to be updated
orderthe order that needs to be captured when the best is updated
crossing_retrieval_functionfunction that returns the current value – to be compared to the best value

Definition at line 263 of file stats.c.

References crossing_stats_double::best, crossing_stats_double::best_heuristic_iteration, pareto_item::iteration, crossing_stats_double::name, and save_order().

Referenced by update_best_all().

Here is the call graph for this function:

◆ update_best_int()

void update_best_int ( CROSSING_STATS_INT stats,
Orderptr  order,
int(*)(void)  crossing_retrieval_function 
)

Updates the best value if needed, usually at the end of an iteration

Parameters
statsthe stats struct to be updated
orderthe order that needs to be captured when the best is updated
crossing_retrieval_functionfunction that returns the current value – to be compared to the best value

Definition at line 245 of file stats.c.

References crossing_stats_int::best, crossing_stats_int::best_heuristic_iteration, pareto_item::iteration, crossing_stats_int::name, and save_order().

Referenced by update_best_all().

Here is the call graph for this function:

Variable Documentation

◆ bottleneck_stretch

CROSSING_STATS_DOUBLE bottleneck_stretch

Definition at line 151 of file stats.c.

Referenced by no_improvement().

◆ favored_edge_crossings

CROSSING_STATS_INT favored_edge_crossings

Definition at line 149 of file stats.c.

Referenced by no_improvement().

◆ max_edge_crossings

CROSSING_STATS_INT max_edge_crossings

◆ overall_degree

Statistics overall_degree

Definition at line 152 of file stats.c.

◆ pareto_list

PARETO_LIST pareto_list = NULL
static

Definition at line 36 of file stats.c.

◆ total_crossings

◆ total_stretch