Question
CTS
IN
Last activity: 18 Jul 2024 5:07 EDT
Forward and Backward chaining
Hello
Explain the differences between forward and backward chaining
-
Reply
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Maantic Inc
IN
Forward chaining is executed when the value of any of the source properties change. Backward Chaining mode executes when the target property is referenced. Backward chaining is supported only for declare expressions.
Example of forward chaining: A+B=C when property A and B value changes we need to calculate C value.
Example of backward chaining: A=B+C when property B and C value changes we need to calculate A value.
CTS
IN
Thanks for the input, could please add the real time scenario for this question, bit confusing.
Thanks.
Maantic Inc
IN
On the top of mind I can give you an example of forward chaining. In a declare expression you can use sum of a value in a pagelist.
Pegasystems Inc.
CA
Forward chaining updates a target value whenever one of the inputs to the expression changes. If the network of calculations is extensive enough, forward chaining may impact performance. If the calculated value doesn't need to change that frequently, backward chaining limits the impact.
When deciding whether to use forward or backward chaining, consider the frequency of changes and the business value of staying current with the inputs. For example, if you are summing the cost of items on an order in real-time, forward chaining is suitable. However, if the total cost also depends on other charges that are determined later in the check-out process, then there's no need to constantly recalculate the total cost until the relevant information is provided by the user.
In summary:
- Use forward chaining if changes are infrequent or if there is business value in staying current with the inputs.
- Use backward chaining if the network of calculations is extensive and there is limited (or no) value in staying current with the changes.
CTS
IN
Thanks for the input, could please add the real time scenario for this question, bit confusing.
Thanks.
Eclatprime Digital Private Limited
IN
Forward Chaining: It provides the automatic calculations of the property value by executing the declarative rule, when any one of the input property value is changed.
Example: If the Area property depends on the Length and Width property, then forward chaining causes the Area property recomputed each time either Length/Width value changes.
Backward Chaining: It provides the automatic calculations of a property value by executing the declarative rule, when a value is needed for property rather than whenever inputs change.
Example: If the Area property depends on the Length and Width property, then backward chaining causes the Area property recomputed each time the Area property is required.
CTS
IN
Thanks for the input, could please add the real time scenario for this question, bit confusing.
Thanks.