0
votes

I’m using CLIPS for a university project, it’s a question driven expert system, and I need to ask randomly a few initial questions, so I wrote this group of rules, and (set-strategy random):

(defrule ask-age
    (not (age ?))
    =>
    (bind ?answer (question “What’s your age?”))
    (assert (age ?answer)))

(defrule ask-gender
    (not (age ?))
    =>
    (bind ?answer (question “What’s your gender?”))
    (assert (gender ?answer)))

(defrule ask-main-symptom
    (not (main-symptom ? TRUE))
    =>
    (bind ?answer (question “What’s the main symptom?”))
    (assert (main-symptom ?answer TRUE)))

Based upon the knowledge about the main symptom, another group of rules gets activated, and I need to change the conflict resolution strategy. Is it correct to put (set-strategy complexity) in ask-main-symptom rule, after (assert (main-symptom ?answer TRUE))? There is a better way?

(defrule ask-main-symptom
    (not (main-symptom ? TRUE))
    =>
    (bind ?answer (question “What’s the main symptom?”))
    (assert (main-symptom ?answer TRUE))
    (set-strategy complexity))
1

1 Answers

0
votes

There's nothing wrong with it per se, but other than using the random strategy to check for potentially conflicting rules and lex/mea for running programs originally written in OPS5, I've never come across a situation where I used a strategy other than depth let alone using two different strategies during execution. If changing the strategy is one of the project requirements, then I'd do it from a rule, but rather than doing it from the ask-main-symptom rule which will fire randomly in relation to the other question rules, create a lower salience rule that changes the strategy after all the question rules have had an opportunity to execute.