Search code examples
c++clipsexpert-system

CLIPS system halted and not continuing to execute


I am integrating CLIPS expert system following APG docs, Thanks for the great docs, I am successful at integrating CLIPS to my C++ project, My Application runs continuously and feed the Facts to CLIPS system using EnvAssert method and invoke EnvRun, everything works fine until i receive this error.

[PRNTUTIL7] Attempt to divide by zero in / function.

[DRIVE1] This error occurred in the join network
   Problem resides in associated join
      Of pattern #1 in rule RULE-1

[PRCCODE4] Execution halted during the actions of defrule RULE-2.

Once i receive this error, further Assert is working but Run seems not working, but i am sure there are definite matching rules are available but still no rules are fired on next Run.

I understood the error and i can fix it, but i cannot understand the behavior. So i tested it in CLIPS console, there when the error was reported consecutive Run seems working as i expected, but not in case of my application, i want to know the underlying difference.

Ref pseudo-code of Application :

<code to create and initialize CLIPS environment>
EnvReset()
While(true)
{
   <my code to get facts>
   EnvAsset(Fact)
   EnvRun(-1)
   <my code to receive the generated result facts>
}

Note: I dont call RESET before every RUN.


Solution

  • Fixes for resetting the error flags for API calls have been checked into the subversion repository on sourceforge: https://sourceforge.net/p/clipsrules/code/HEAD/tree/branches/