Library: Sub 3 – Based on

Building Pattern--> Structural -->

Based on

When making decisions, people generally take multiple factors into account.

A prospective house buyer might consider the location of the house, the price of the house, how many bedrooms a property has, and any number of other factors, before making an offer. A sales representative would consider the potential value of a client, the relationship with a client, what a client wants to deliver, etc when deciding how hot a sales lead is. This way of thinking can be replicated in Rainbird by using ‘based on’ rules.

Intent

Rainbird is able to make decisions by considering multiple different factors before reaching a result. A ‘based on’ rule is a rule that considers one factor, and will generally produce a result based on that one factor. Multiple ‘based on’ rules can be brought together into one ‘overall’ rule.

Applicability

‘Based on’ rules are one of the most commonly used types of rules and can be applied pretty much anywhere Rainbird has to make a decision considering different factors, from simple recommendation tools to more complex qualification tools.

Limitations 

Elements

Based on’ rules are structured the same way as basic triangle rules

Figure 1: The based on colour rule Triangle

Let’s build a model that will use ‘based on’ rules to recommend a car to a user. The first factor we’ll build a ‘based on’ rule for is car colour. ‘Colour’ and ‘car’ concept instance have been created, and facts have been created on the ‘is in colour’ relationship:

Figure 2: The based on colour rule Triangle

When running a query on the ‘based on colour’ relationship, Rainbird will ask the user what colour car they want and recommend cars purely based on the colour the user chooses:

Someone in the market for a new car is unlikely to buy a car based purely on colour. They might also consider the type of engine a car has.

We’ve added a new concept, ‘Engine’, to the model, and created some new relationships between ‘Car’ and ‘Engine’ (questions set to off), ‘Person’ and ‘Engine’ (questions set to second form object), and a new relationship between ‘Person’ and ‘Car’ called ‘based on engine type’.

Questions for the relationship between On the ‘based on engine type’ is another ‘triangle rule’:

Figure 3: Additional Base on rule for Engine Type

When running the ‘based on engine type’ relationship, Rainbird will recommend a car based on the engine type the user wants:

The ‘based on’ rules can be brought together in one ‘overall’ rule. A relationship between ‘Person’ and ‘Car’ called ‘Overall’ has been created (questions has been set to off on the ‘overall’ relationship) and the two relationships that recommend a car based on colour and based on engine type have been added as conditions on the ‘overall’ relationship:

Figure 4: Creating the overall rule

When querying the ‘overall’ relationship, Rainbird will now only recommend a car if the car is both in the colour the user wants, and has the type of engine the user wants:

Both of the conditions in the ‘overall’ relationship are set to ‘Mandatory’, so Rainbird will only return a result if both of the conditions are met. If the conditions are set to optional, or a mixture of mandatory and optional, Rainbird will recommend cars that don’t quite match the user’s requirements at a lower certainty factor. The clip below demonstrates how the results will change, depending on whether the conditions are mandatory or optional:

Different weightings can be set if some factors are more important than others:

Using the same basic triangle structure, more ‘based on’ rules can be built and added to the ‘overall’ relationship:

Individual ‘based on’ rules can be combined into other ‘based on’ rules which can help when managing rules with a lot of individual rules.

We create a category (similar to the overall rule) where we combine the two aesthetic rules ‘based on interior’ and ‘based on colour’ in a new rule based on aesthetic’:

Then we can remove the existing based on rules (colour and interior) and add the new rule ‘based on aesthetic’.

It is important to mention, that this will now impact on the Certainty Factor. Before this change each based on rule had 1/5th of the impact (some with less weighting). After the change the impact for each based on rule is 1/4th; where colour and interior share an impact in the aesthetic rule. 

Figure 5: Replacing Based on rules in the overall rule

More information on weighting can be found in the Weight Article.

Query & Results

Run the overall rule to see the result for all based on rules combined.

Implementation Hints

  • Make sure to switch off questions on the ‘based on’ relationships
  • If you’re finding Rainbird cannot produce an answer when running an ‘overall’ query, try setting some of the conditions to ‘optional’ or reducing the minimum rule certainty
  • Setting the rules to ‘optional’ will also help you troubleshoot your ‘overall’ relationship as the evidence tree will show you which conditions of the ‘overall’ relationship have not been satisfied
The RBLang below will generate the example map used in the ‘subject’ section of the article. Click on ‘Export .rbird’ to download the knowledge map, or ‘copy RBLang’ and paste the code directly into Rainbird.

Article Feedback form
Did you find this article useful?

Version 1.02 – Last Update: 19/02/2021

Bitnami