0
votes

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.

1
Try downloading the most recent version of the source code: sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x. There was a bug with embedded use where the error flag was not getting reset. - Gary Riley
Thanks @GaryRiley will try it now, and update. - Vishal Santharam
@GaryRiley I tried testing with 63x but same result, attached testing code i used. FYI, I downloaded snapshot from the link you shared and copied C files from CORE folder to windows\Source\CLIPS and compiled CLIPS_MVS_2019 and used that lib for testing. - Vishal Santharam
The code for resetting the error flags was in the run place in the EnvRun function. You can download the fix for it here: sourceforge.net/p/clipsrules/code/HEAD/tree/branches/63x/core/… - Gary Riley
@GaryRiley the fix worked, but a small concern is Agenda was not updating properly for the consecutive RUNs after error. I tried to print Agenda using EnvAgenda(ClipsEnv, "STDOUT", NULL), For the first run it properly prints the Agenda but not for consecutive RUNs. - Vishal Santharam

1 Answers

1
votes

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/