[id='forward-and-backward-chaining-con_{context}']

= Rule evaluation with forward and backward chaining

The {RULE_ENGINE} in {PRODUCT} is a hybrid reasoning system that uses both forward chaining and backward chaining to evaluate rules. A forward-chaining rule system is a data-driven system that starts with a fact in the working memory of the {RULE_ENGINE} and reacts to changes to that fact. When objects are inserted into working memory, any rule conditions that become true as a result of the change are scheduled for execution by the agenda.

In contrast, a backward-chaining rule system is a goal-driven system that starts with a conclusion that the {RULE_ENGINE} attempts to satisfy, often using recursion. If the system cannot reach the conclusion or goal, it searches for subgoals, which are conclusions that complete part of the current goal. The system continues this process until either the initial conclusion is satisfied or all subgoals are satisfied.

The following diagram illustrates how the {RULE_ENGINE} evaluates rules using forward chaining overall with a backward-chaining segment in the logic flow:

.Rule evaluation logic using forward and backward chaining
ifdef::DROOLS,JBPM,OP[]
image::rule-engine/RuleEvaluation.png[align="center"]
endif::[]
ifdef::DM,PAM[]
image::rule-engine/RuleEvaluation_Enterprise.png[align="center"]
endif::[]
