Self-Healing Process
-
First check if the old rules of the SmartTag still apply.
-
Rules that are still found will be marked as successes (successes: 1, failures: 0) and rules that were no longer found will be marked as failures (successes: 0, failures: 1).
-
In the case of SmartTags with the onePerPage modifier, the rule will be checked in every single occurrence of the SmartTag, and then we add up the results and report the number of successes and failures (for example successes: 10, failures: 4).
-
-
Once we have the number of successes and failures, we proceed to update the weight of the rule. In our self-healing algorithm, weights will be updated in the following way:
-
The weight of a successful rule will be doubled and a small additional weight of 10 will be added.
-
The weight of a failed rule will remain the same.
-
Then the new weights will be normalized to 1000.
For example: let's suppose rule A has an initial weight of 750 and rule B an initial weight of 250, and rule A was successful but rule B failed. So the new weight of A will be 1510 while the new weight of B will still be 250. Then we normalize to 1000 and we obtain a final normalized weight of 85 f8or A and 142 for B.
A: 750 + 750 + 10 -> 1510 -> 858
B: 250 + 0 -> 250 -> 142 -
In the case of onePerPage SmartTags with several successes and failures greater than 0 or 1, weights will be calculated as in the following example. Suppose rule A has an initial weight of 600 and B an initial weight of 400, and rule A got 4 successes and 1 failure, and rule B got 2 successes and 3 failures. So for A, we add 600*4 + 10*4 to the original 600 and for B we add 400*2 + 10*2 to the original 400, to get a new weight of 3040 for A and a net weight of 1220 for B. Then we normalize to 1000 and obtain a final normalized weight of 714 for A and 286 for B.
A: 600 + 600*4 + 10*4 -> 3040 -> 714
B: 400 + 400*2 + 10*2 -> 1220 -> 286If the SmartTag contains less than 5 rules, we can detect new rules and add them to it. Example: Let's suppose we originally only have rule A with a weight of 1000. Then we find that rule A was successful and a new rule B was also successful. Rule A will double its weight to 2000 and rule B will start with a weight of 100. Then we normalize.
A: 1000 + 1000 + 10 -> 2010 -> 948
B: 0 + 100 + 10 -> 110 -> 52For onePerPage SmartTags, we multiply by the number of successes. For example, let's suppose the original rule A got 2 successes and 1 failure, and the new rule B got 3 successes and no failures. Then their weights will be recalculated in the following way:
A: 1000 + 1000*2 + 10*2 -> 3020 -> 901
B: 0 + 100*3 + 10*3 -> 330 -> 99 -
Finally, we will remove rules whose weight is less than 10 (or 1%). Re-normalize after removing rules.
-
Click here to also a video showing how self-healing works
While the script is being self-healed, the IDE will highlight the steps that got changed as part of the self-healing process.