Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

statistics.h File Reference

Definition of the Tstatistics type and the associated functions. More...

#include "boolean.h"
#include <time.h>
#include <sys/times.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  Tstatistics
 Statistics associated with a solving process. More...

Functions

void InitStatistics (unsigned int np, double v, Tstatistics *t)
 Constructor.
void CopyStatistics (Tstatistics *t_dst, Tstatistics *t_src)
 Copy constructor.
double GetTime (Tstatistics *t)
 Curent time.
double GetElapsedTime (Tstatistics *t)
 Elapsed time.
double GetInitialTime (Tstatistics *t)
 Initial time.
void SetInitialTime (double tm, Tstatistics *t)
 Sets a new initial time.
void NewMaxLevel (unsigned int m, Tstatistics *t)
 Sets a new maximum level.
void NewBoxProcessed (Tstatistics *t)
 Increases the number of processed boxes.
void NewSolutionBox (boolean validated, double v, double d, Tstatistics *t)
 Increases the number of solution boxes.
void NewEmptyBox (Tstatistics *t)
 Increases the number of empty boxes.
void NewSplittedBox (Tstatistics *t)
 Increases the number of splitted boxes.
void NewRBError (Tstatistics *t)
 Increases the number of errors when reducing a boxe.
void NewLostBox (Tstatistics *t)
 Increases the number of lost boxes.
void NewBoxReduction (Tstatistics *t)
 Increases the number of reduced boxes.
unsigned int GetNBoxReductions (Tstatistics *t)
 Gets the number of reduced boxes.
unsigned int GetNSolutionBoxes (Tstatistics *t)
 Gets the number of solution boxes.
void ResetNBoxReductions (Tstatistics *t)
 Resets the number of reduced boxes.
void AddNBoxReductions (unsigned int nr, Tstatistics *t)
 Increases the number of reduced boxes.
void PrintStatistics (FILE *f, Tstatistics *t)
 Prints the statistics to a file.
void SaveStatistics (FILE *f, Tstatistics *t)
 Saves the statistics to a file in binary format.
void LoadStatistics (FILE *f, Tstatistics *t)
 Loads the statistics from a file in binary format.
void DeleteStatistics (Tstatistics *t)
 Destructor.

Detailed Description

Module for keeping track of the workings of the CuikSolve process.

See also:
Tstatistics, statistics.c.

Definition in file statistics.h.


Function Documentation

void InitStatistics ( unsigned int  np,
double  v,
Tstatistics t 
)

Initializes a set of statistics.

Parameters:
np Number of processors.
v Volume of the search space.
t The statistics to initialize.

Definition at line 21 of file statistics.c.

References GetTime(), Tstatistics::n_box_reductions, Tstatistics::n_empty_boxes, Tstatistics::n_errors, Tstatistics::n_lost_boxes, Tstatistics::n_max_level, Tstatistics::n_processed_boxes, Tstatistics::n_solution_boxes, Tstatistics::n_splitted_boxes, Tstatistics::n_validated_solution_boxes, Tstatistics::np, Tstatistics::s_diagonal, Tstatistics::s_volume, Tstatistics::t_init, and Tstatistics::volume.

Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().

Here is the call graph for this function:

Here is the caller graph for this function:

void CopyStatistics ( Tstatistics t_dst,
Tstatistics t_src 
)

Initializes a set of statistics fom another set.

Parameters:
t_dst The statistics to initialize.
t_src The statistics from where to copy.

Definition at line 45 of file statistics.c.

References Tstatistics::n_box_reductions, Tstatistics::n_empty_boxes, Tstatistics::n_errors, Tstatistics::n_lost_boxes, Tstatistics::n_max_level, Tstatistics::n_processed_boxes, Tstatistics::n_solution_boxes, Tstatistics::n_splitted_boxes, Tstatistics::n_validated_solution_boxes, Tstatistics::s_diagonal, Tstatistics::s_volume, Tstatistics::t_init, and Tstatistics::volume.

Referenced by CopyCuikSystem().

Here is the caller graph for this function:

double GetTime ( Tstatistics t  ) 

Returns the current time. The wayt to get the time is different for single-processor or for multiple-processor environments.

Parameters:
t The statistics.
Returns:
The current time.

Definition at line 74 of file statistics.c.

References Tstatistics::np.

Referenced by GetElapsedTime(), InitStatistics(), and LoadCSState().

Here is the caller graph for this function:

double GetElapsedTime ( Tstatistics t  ) 

Returns the time since the statistics where initialized.

Parameters:
t The statistics to query.
Returns:
The elapsed time.

Definition at line 92 of file statistics.c.

References GetTime(), and Tstatistics::t_init.

Referenced by PostProcessBox(), PrintStatistics(), and SaveCSState().

Here is the call graph for this function:

Here is the caller graph for this function:

double GetInitialTime ( Tstatistics t  ) 

Returns the time at which the statistics where initialized.

Parameters:
t The statistics to query.
Returns:
The initialization time.

Definition at line 100 of file statistics.c.

References Tstatistics::t_init.

void SetInitialTime ( double  tm,
Tstatistics t 
)

Sets a new initial time. This is used when re-starting a process after a crash.

Parameters:
tm The new initial time.
t The statistics to query.

Definition at line 109 of file statistics.c.

References Tstatistics::t_init.

Referenced by LoadCSState().

Here is the caller graph for this function:

void NewMaxLevel ( unsigned int  m,
Tstatistics t 
)

Sets a new max level. If the given level is below the stored one nothing is done.

Parameters:
m The new maximum level.
t The statistics to udpate.

Definition at line 117 of file statistics.c.

References Tstatistics::n_max_level.

Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().

Here is the caller graph for this function:

void NewBoxProcessed ( Tstatistics t  ) 

Increases the number of processed boxes.

Parameters:
t The statistics to update.

Definition at line 126 of file statistics.c.

References Tstatistics::n_processed_boxes.

Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().

Here is the caller graph for this function:

void NewSolutionBox ( boolean  validated,
double  v,
double  d,
Tstatistics t 
)

Increases the number of solution boxes.

Parameters:
validated TRUE if the solution is validated to include a solution point.
v Volume of the solution box.
d Diagonal of the solution box.
t The statistics to update.

Definition at line 134 of file statistics.c.

References Tstatistics::n_solution_boxes, Tstatistics::n_validated_solution_boxes, Tstatistics::s_diagonal, and Tstatistics::s_volume.

Referenced by PostProcessBox().

Here is the caller graph for this function:

void NewEmptyBox ( Tstatistics t  ) 

Increases the number of empty boxes.

Parameters:
t The statistics to update.

Definition at line 147 of file statistics.c.

References Tstatistics::n_empty_boxes.

Referenced by PostProcessBox().

Here is the caller graph for this function:

void NewSplittedBox ( Tstatistics t  ) 

Increases the number of splitted boxes.

Parameters:
t The statistics to update.

Definition at line 156 of file statistics.c.

References Tstatistics::n_splitted_boxes.

Referenced by PostProcessBox().

Here is the caller graph for this function:

void NewRBError ( Tstatistics t  ) 

Increases the number of errors when reducing a boxe.

Parameters:
t The statistics to update.

Definition at line 165 of file statistics.c.

References Tstatistics::n_errors.

Referenced by PostProcessBox().

Here is the caller graph for this function:

void NewLostBox ( Tstatistics t  ) 

Increases the number of lost boxes.

Parameters:
t The statistics to update.

Definition at line 173 of file statistics.c.

References Tstatistics::n_lost_boxes.

Referenced by MPI_SolveCuikSystem().

Here is the caller graph for this function:

void NewBoxReduction ( Tstatistics t  ) 

Increases the number of reduced boxes.

Parameters:
t The statistics to update.

Definition at line 181 of file statistics.c.

References Tstatistics::n_box_reductions.

Referenced by ReduceBox().

Here is the caller graph for this function:

unsigned int GetNBoxReductions ( Tstatistics t  ) 

Gets the number of reduced boxes.

Parameters:
t The statistics to query.
Returns:
The number of reduced boxes up to the moment.

Definition at line 186 of file statistics.c.

References Tstatistics::n_box_reductions.

Referenced by MPI_TreatBox().

Here is the caller graph for this function:

unsigned int GetNSolutionBoxes ( Tstatistics t  ) 

Gets the number of solution boxes.

Parameters:
t The statistics to query.
Returns:
The number of solution boxes up to the moment.

Definition at line 191 of file statistics.c.

References Tstatistics::n_solution_boxes.

Referenced by PostProcessBox(), and SolveCuikSystem().

Here is the caller graph for this function:

void ResetNBoxReductions ( Tstatistics t  ) 

Resets the number of reduced boxes.

Parameters:
t The statistics to update.

Definition at line 196 of file statistics.c.

References Tstatistics::n_box_reductions.

Referenced by MPI_TreatBox().

Here is the caller graph for this function:

void AddNBoxReductions ( unsigned int  nr,
Tstatistics t 
)

Increases the number of reduced boxes.

Parameters:
nr Number of reduced boxes to add to the current statistis.
t The statistics to update.

Definition at line 201 of file statistics.c.

References Tstatistics::n_box_reductions.

Referenced by MPI_SolveCuikSystem().

Here is the caller graph for this function:

void PrintStatistics ( FILE *  f,
Tstatistics t 
)

Write the statistics sets to a stream that can be stdout. The moment at which the statistics are written is taken as the moment at which the solving process is done.

Parameters:
f The stream
t The statistics to print.

Definition at line 209 of file statistics.c.

References GetElapsedTime(), Tstatistics::n_box_reductions, Tstatistics::n_empty_boxes, Tstatistics::n_errors, Tstatistics::n_lost_boxes, Tstatistics::n_max_level, Tstatistics::n_processed_boxes, Tstatistics::n_solution_boxes, Tstatistics::n_splitted_boxes, Tstatistics::n_validated_solution_boxes, Tstatistics::np, Tstatistics::s_diagonal, Tstatistics::s_volume, and Tstatistics::volume.

Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().

Here is the call graph for this function:

Here is the caller graph for this function:

void SaveStatistics ( FILE *  f,
Tstatistics t 
)

Saves the statistics to a file in binary format. Used to save the internal state of the solver.

Parameters:
f The file
t The statistics to print.

Definition at line 260 of file statistics.c.

Referenced by SaveCSState().

Here is the caller graph for this function:

void LoadStatistics ( FILE *  f,
Tstatistics t 
)

Loads the statistics from a file in binary format. Used to retrive the internal state of the solver from a .state file.

Parameters:
f The file
t The statistics to print.

Definition at line 266 of file statistics.c.

Referenced by LoadCSState().

Here is the caller graph for this function:

void DeleteStatistics ( Tstatistics t  ) 

Deletes the statistics structure and frees the allocated memory.

Parameters:
t The statistics to delete.

Definition at line 274 of file statistics.c.

Referenced by DeleteCuikSystem(), and MPI_SolveCuikSystem().

Here is the caller graph for this function: