Do I mark a function as Changed so that its reevaluated and not cached in Rete Algorithm #301
-
Should I be marking a function to be reevaluated if I know the underlying was changed by a rule execution so that it is reevaluated in the next cycle? For example Is that the correct syntax? Thank you for any pointers. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @shreyaspurohit , Looking at the logic of // Reset will reset the evaluated status of a specific variable if its contains a variable name in its signature.
// Returns true if any expression was reset, false if otherwise
func (e *WorkingMemory) Reset(name string) bool {
AstLog.Tracef("------- resetting %s", name)
for _, vari := range e.variableSnapshotMap {
if vari.GrlText == name {
return e.ResetVariable(vari)
}
}
for snap, expr := range e.expressionSnapshotMap {
if strings.Contains(snap, name) || strings.Contains(expr.GrlText, name) {
expr.Evaluated = false
}
}
for snap, expr := range e.expressionAtomSnapshotMap {
if strings.Contains(snap, name) || strings.Contains(expr.GrlText, name) {
expr.Evaluated = false
}
}
return false
} The function will look for function/variable signature/expression in the working memory. If it founds it, it will mark that |
Beta Was this translation helpful? Give feedback.
-
I tested this and it works perfectly. Thank you! |
Beta Was this translation helpful? Give feedback.
Hi @shreyaspurohit ,
Yes, that's how you do it.
Looking at the logic of
Reset
function inWorkingMemory.go