Search code examples
ruleexpert-systemreasoning

Rule based system initial fact processing


I have a confusion after discussion with one of my fellow on the rule base system. I have developed one in Android which has set of rules. What i say is that initial facts have to match any rule in order to start the engine, so we can directly start matching the initial facts without sending them to working memory.

the fellow says that NO, the initial facts has to enter the working memory and then matching should start and i agree till here but he also adds that you only need to get the variables from the initial facts and then match the rules for example io have a rule

a(variable),b(constant)
Initial facts in Working memory is a(VAR_VALUE)

so will it invoke the rule

a(variable),b(constant)

if the answer is yes then we can have a lot of such rules with constant values that can be invoked even when the working memory is empty.

i need some expert opinion on the issue above, so i may do the development changes as required.


Solution

  • Check the predicate match first, uf same then check if the subject is variable or not. If not then match with correapong rule if both subjects same then it will match. Rules with comstants has to match elementa of wm. Otherwise it will b infinite loop. As aingle variable can come with any number of constants. Also use better conflict reaolution strategy.