heur.h File Reference

Heuristic management module. More...

#include <oski/common.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define INC_OSKI_HEUR_H
 oski/heur.h included.
#define OSKI_HEUR_METHOD(type, name)
 Retrieve the method for a particular heuristic.
#define OSKI_HEURID_METHOD(type_id, name)
 Retrieve the method for a particular heuristic type given the heuristic type id.

Functions

void oski_InitHeurManager (void)
 Open/initialize the heuristic manager.
void oski_CloseHeurManager (void)
 Shutdown heuristic manager.
oski_id_t oski_RegisterHeur (const char *name, oski_id_t id_ind, oski_id_t id_val)
 Register a new heuristic with the heuristic manager.
size_t oski_GetNumHeur (void)
 Returns the number of available heuristics.
const char * oski_LookupHeurDescById (oski_id_t id)
 Returns a short descriptive string for the specified heuristic.
oski_id_t oski_LookupHeurId (const char *name, oski_id_t id_ind, oski_id_t id_val)
 Returns the id number of a specified heuristic.
oski_id_t oski_LookupHeurIdByNum (size_t i)
 Returns the id number of the i-th heuristic.
void * oski_LookupHeurIdMethod (oski_id_t id, const char *method_name)
 Return a method stored in a heuristic module, found by heuristic id.
void * oski_LookupHeurMethod (const char *heur_name, oski_id_t id_ind, oski_id_t id_val, const char *method_name)
 Return a method stored in a heuristic module, found by heuristic type.
FILE * oski_OpenBenchmarkData (const char *filename)
 Opens a file containing off-line benchmarking data for reading.
void oski_CloseBenchmarkData (FILE *fp)
 Close an open file containing off-line benchmark data.
int oski_ReadBenchmarkLine (FILE *fp, char *buffer, size_t max_len)
 Reads the first non-comment line in the given benchmark data file.


Detailed Description

Heuristic management module.


Define Documentation

#define INC_OSKI_HEUR_H

oski/heur.h included.

#define OSKI_HEUR_METHOD ( type,
name   ) 

Value:

Retrieve the method for a particular heuristic.

Relies on the compile-time default scalar type macros, OSKI_IND_ID and OSKI_VAL_ID.

Parameters:
[in] type Heuristic type name, as a string.
[in] name Method base name (not as a string constant).
Returns:
A function pointer of the appropriate type, or NULL on error.

#define OSKI_HEURID_METHOD ( type_id,
name   ) 

Value:

(OSKI_MAKENAME_FUNCPT(name))oski_LookupHeurIdMethod( \
        type_id, "oski_" MACRO_TO_STRING(name) \
    )
Retrieve the method for a particular heuristic type given the heuristic type id.

Parameters:
[in] type_id Heuristic type, by ID.
[in] name Method base name (not as a string constant).
Returns:
A function pointer of the appropriate type, or NULL on error.

Referenced by oski_ApplyHeurResults(), oski_EstimateHeurCost(), oski_EvaluateHeur(), and oski_IsHeurApplicable().


Function Documentation

void oski_CloseHeurManager ( void   ) 

size_t oski_GetNumHeur ( void   ) 

Returns the number of available heuristics.

References oski_GetNumHeur(), and simplelist_GetLength().

Referenced by oski_FindHeurRecord(), oski_GetNumHeur(), oski_LookupHeur(), and oski_TuneMat().

void oski_InitHeurManager ( void   ) 

Open/initialize the heuristic manager.

References oski_InitHeurManager(), oski_PrintDebugMessage(), and simplelist_Create().

Referenced by oski_Init(), and oski_InitHeurManager().

const char* oski_LookupHeurDescById ( oski_id_t  id  ) 

Returns a short descriptive string for the specified heuristic.

References oski_heurrec_t::desc, oski_FindHeurRecord(), and oski_LookupHeurDescById().

Referenced by oski_ApplyHeurResults(), oski_LookupHeurDescById(), and oski_TuneMat().

oski_id_t oski_LookupHeurId ( const char *  name,
oski_id_t  id_ind,
oski_id_t  id_val 
)

Returns the id number of a specified heuristic.

References oski_heurrec_t::id, INVALID_ID, oski_LookupHeur(), and oski_LookupHeurId().

Referenced by oski_LookupHeurId(), oski_LookupHeurMethod(), and oski_RegisterHeur().

oski_id_t oski_LookupHeurIdByNum ( size_t  i  ) 

Returns the id number of the i-th heuristic.

References oski_heurrec_t::id, INVALID_ID, oski_LookupHeurIdByNum(), and simplelist_GetElem().

Referenced by oski_LookupHeurIdByNum(), and oski_TuneMat().

void* oski_LookupHeurIdMethod ( oski_id_t  id,
const char *  method_name 
)

Return a method stored in a heuristic module, found by heuristic id.

References oski_heurrec_t::module, oski_FindHeurRecord(), oski_LookupHeurIdMethod(), and oski_LookupModuleMethod().

Referenced by oski_LookupHeurIdMethod(), and oski_LookupHeurMethod().

void* oski_LookupHeurMethod ( const char *  heur_name,
oski_id_t  id_ind,
oski_id_t  id_val,
const char *  method_name 
)

Return a method stored in a heuristic module, found by heuristic type.

References INVALID_ID, oski_LookupHeurId(), oski_LookupHeurIdMethod(), oski_LookupHeurMethod(), and oski_RegisterHeur().

Referenced by oski_LookupHeurMethod().

FILE* oski_OpenBenchmarkData ( const char *  filename  ) 

Opens a file containing off-line benchmarking data for reading.

Parameters:
[in] filename Name of the benchmark data file. This name should only contain a relative path.
If an environment variable named 'OSKI_BENCH_DIR' is defined, then this routine searches for 'filename' in that path first, before checking the default directory, OSKI_BENCH_DIR_DEFAULT (compile-time macro).

Returns:
Returns NULL on error, but does not call the error handler so this routine can be used to check quietly for file existence. Otherwise, returns a valid pointer to an open file for reading on success.

References oski_OpenBenchmarkData().

Referenced by oski_OpenBenchmarkData().

int oski_ReadBenchmarkLine ( FILE *  fp,
char *  buffer,
size_t  max_len 
)

Reads the first non-comment line in the given benchmark data file.

Parameters:
[in] fp Pointer to a benchmark data file.
[in,out] buffer Buffer in which to store the next line.
[in] max_len Maximum length of 'buffer'.
Returns:
Returns 0 when the end-of-file is reached, or 1 if a non-comment line was read from the file. 'buffer' always contains the last line read from the file regardless of the return value.

References oski_ReadBenchmarkLine().

Referenced by oski_ReadBenchmarkLine().

oski_id_t oski_RegisterHeur ( const char *  name,
oski_id_t  id_ind,
oski_id_t  id_val 
)


Generated on Fri Apr 8 22:35:19 2011 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.5.9