- Improved candidates throughput.

This commit is contained in:
ccremers 2004-07-20 09:07:43 +00:00
parent a588c90952
commit d74d70218f
3 changed files with 22 additions and 14 deletions

View File

@ -383,7 +383,7 @@ knowledgeInversesPrint (Knowledge know)
*\sa termlistDelete() *\sa termlistDelete()
*/ */
Termlist Termlist
knowledgeSet (Knowledge know) knowledgeSet (const Knowledge know)
{ {
Termlist tl1, tl2; Termlist tl1, tl2;
@ -397,7 +397,7 @@ knowledgeSet (Knowledge know)
* Essentially the inverse function of knowledgeSetInverses() * Essentially the inverse function of knowledgeSetInverses()
*/ */
Termlist Termlist
knowledgeGetInverses (Knowledge know) knowledgeGetInverses (const Knowledge know)
{ {
if (know == NULL) if (know == NULL)
return NULL; return NULL;
@ -405,6 +405,20 @@ knowledgeGetInverses (Knowledge know)
return know->inverses; return know->inverses;
} }
//! Get all basic elements in the knowledge
/**
* This function is used by match_basic, to determine all basic elements in the knowledge set.
* Most of the time this doesn't even change, so it might become a parameter of knowledge.
* For now, this will have to do.
*
*@todo Investigate whether the basics in the knowledge set should be a parameter of knowledge, as it doesn't change very often.
*/
__inline__ Termlist
knowledgeGetBasics (const Knowledge know)
{
return termlistAddBasics (termlistAddBasics(NULL, know->basic), know->encrypt);
}
//! check whether any substitutions where made in a knowledge set. //! check whether any substitutions where made in a knowledge set.
/** /**
* Typically, when a substitution is made, a knowledge set has to be reconstructed. * Typically, when a substitution is made, a knowledge set has to be reconstructed.

View File

@ -43,8 +43,9 @@ int inKnowledge (const Knowledge know, Term term);
void knowledgePrint (Knowledge know); void knowledgePrint (Knowledge know);
void knowledgeInversesPrint (Knowledge know); void knowledgeInversesPrint (Knowledge know);
int isKnowledgeEqual (Knowledge know1, Knowledge know2); int isKnowledgeEqual (Knowledge know1, Knowledge know2);
Termlist knowledgeSet (Knowledge know); Termlist knowledgeSet (const Knowledge know);
Termlist knowledgeGetInverses (Knowledge know); Termlist knowledgeGetInverses (const Knowledge know);
Termlist knowledgeGetBasics (const Knowledge know);
int knowledgeSubstNeeded (const Knowledge know); int knowledgeSubstNeeded (const Knowledge know);
Knowledge knowledgeSubstDo (const Knowledge know); Knowledge knowledgeSubstDo (const Knowledge know);
void knowledgeSubstUndo (const Knowledge know); void knowledgeSubstUndo (const Knowledge know);

View File

@ -13,20 +13,13 @@
#include "modelchecker.h" #include "modelchecker.h"
#include "match_basic.h" #include "match_basic.h"
Termlist //! Get the candidates list for typeless basic stuff
__inline__ Termlist
candidates (const Knowledge know) candidates (const Knowledge know)
{ {
Termlist knowset; return knowledgeGetBasics (know);
Termlist candlist;
/* candidates for typeless basic stuff */
knowset = knowledgeSet (know);
candlist = termlistAddBasics (NULL, knowset);
termlistDelete (knowset);
return candlist;
} }
struct fvpass struct fvpass
{ {
int (*solution) (struct fvpass, Knowledge); int (*solution) (struct fvpass, Knowledge);