Data Structures | |
struct | ScoreCacheStruct |
Defines | |
#define | DEBUG_SCORECACHE 0 |
#define | indexOfPair(x, y) ((x<y) ? (((y*(y-1))>>1)+x) : (((x*(x-1))>>1)+y)) |
Typedefs | |
typedef ScoreCacheStruct * | ScoreCache |
Functions | |
void | scDelete (ScoreCache cache) |
Number | scGetScore (ScoreCache cache, LevelValue a, LevelValue b) |
void | scInitialize () |
ScoreCache | scNew (int noValues) |
void | scSetScore (ScoreCache cache, LevelValue a, LevelValue b, Number score) |
Variables | |
Boolean | scUseCache |
Boolean | scUseCache = FALSE |
|
|
determines the index of a given pair Definition at line 39 of file scache.c. Referenced by scGetScore(), scNew(), and scSetScore(). |
|
Pointer to ScoreCacheStruct Definition at line 45 of file scache.h. Referenced by scDelete(), scGetScore(), scNew(), and scSetScore(). |
|
free memory from a cache This function deallocates a cache. Definition at line 88 of file scache.c. References ScoreCacheStruct::data, and ScoreCache. Referenced by cnDelete(), cnRenew(), comCompareAllLvPairs(), and comCompareWithContext(). |
|
retrieve score from cache if available, else return -1.0 This function returns the mutual score for the LVs a and b from the score. If it is not yet known, -1 is returned. Definition at line 102 of file scache.c. References ScoreCacheStruct::data, ScoreCacheStruct::hits, indexOfPair, ScoreCache, and ScoreCacheStruct::size. Referenced by evalBinary(). |
|
initialize the module Scache. It registers the module's CDG variables. Definition at line 216 of file scache.c. References NULL, and scUseCache. Referenced by cdgInitialize(). |
|
return an initial score-cache This function returns a pointer to a new cache. The fields count and hits are initialized to 0. All elements of the underlying Vector are set to -1. Definition at line 62 of file scache.c. References ScoreCacheStruct::capacity, ScoreCacheStruct::count, ScoreCacheStruct::data, ScoreCacheStruct::hits, indexOfPair, ScoreCache, and ScoreCacheStruct::size. Referenced by cnBuildFinal(), cnRenew(), comCompareAllLvPairs(), and comCompareWithContext(). |
|
store score in cache This function registers a binary score in the cache. It behaves as follows:
References ScoreCacheStruct::capacity, CDG_DEBUG, CDG_ERROR, cdgPrintf(), ScoreCacheStruct::count, ScoreCacheStruct::data, indexOfPair, ScoreCache, and ScoreCacheStruct::size. Referenced by evalBinary(). |
|
implements the CDG variable cache. If this flag is set, binary constraints are never evaluated twice on the same pair of LVs. The function evalBinary() will then simply call scGetScore() instead of evalConstraint(). This variable is exported because it's cheaper for the calling function to check a boolean variable than calling a cache function which does nothing again and again. Definition at line 53 of file scache.c. Referenced by cmdIncrementalCompletion(), cmdStatus(), cnBuildFinal(), cnRenew(), comCompareAllLvPairs(), comCompareWithContext(), evalBinary(), and scInitialize(). |
|
implements the CDG variable cache. If this flag is set, binary constraints are never evaluated twice on the same pair of LVs. The function evalBinary() will then simply call scGetScore() instead of evalConstraint(). This variable is exported because it's cheaper for the calling function to check a boolean variable than calling a cache function which does nothing again and again. Definition at line 53 of file scache.c. Referenced by cmdIncrementalCompletion(), cmdStatus(), cnBuildFinal(), cnRenew(), comCompareAllLvPairs(), comCompareWithContext(), evalBinary(), and scInitialize(). |