“Monkey Business” Analyzed

I decided to add the decision model “Monkey Business” to our new What-If Analyzer. It brought several considerations missed by other solutions. In this post I will discuss my implementation and will show how What-If Analyzer helps to do a through analysis of usually unnoticed aspects of business decision modeling. Here is the problem formulation as it was published at DMCommunity.org Challenge in Nov-2015:

MonkeyBusinessProblem

Each out of 4 monkeys has a fruit and a resting place. So, it is quite obvious that this problem has 8 unknowns (decision variables) that I put in the following glossary:

MonkeyOR.Glossary

Looking at the above problem’s description, we may conclude that there are two types of rules here:

  • rules that describe the situation the kinds oversaw during that particular lunchtime;
  • rules that describe monkeys preferences regarding fruits and resting places.

So, I put the Situation Rules in this decision table:

MonkeyOR.SituationRules

My Preference Rules went to this decision table:

MonkeyOR.PreferenceRules

The situation description also says that “each monkey ate a different fruit”. So, I added the proper rules as follows:

MonkeyOR.DiffFruits

Note that in other situations some monkey may eat same fruits. That’s why I added the first column “On/Off” to be able to turn some rules off (“deactivate”)  when the same decision model may be applied to different situations.

I noticed that two other (already provided) solutions assumed that each monkey sits in a different resting place. However, I do not see this observation anywhere in the problem formulations. Besides, even if it was a case at this particular situation, some monkeys may share resting places in other situations. So, I decided to add these rules but to turn them off as below:

MonkeyOR.DiffPlaces

To complete the decision model I put all above rules in one Decision:

MonkeyOR.Main

Then I simply added a reference to this decision model to our recently published What-If Analyzer, and when I opened it I got the following picture:

MonkeyOR.WhatIf1

On the left, you can see Decision Variables:

MonkeyOR.WhatIf2

The column “Possible Values” shows the current feasible values that correspond to already activated rules. Some decision variables already instantiated (e.g. we already know resting places for Sam and Anna) and others remain unknown.

On the right you can see all rules collected from the above decision tables with their current status “Active” being On (checked) or Off (unchecked):

MonkeyOR.WhatIf3

If we click on the button “Solution”, we will immediately receive the following solution:

MonkeyOR.WhatIf4

All decision variables in the found solution have only one value (instantiated), and now we know  “what kind of fruit each monkey ate, and where their favorite resting place was“.

But is this the only possible solution? Let’s click on the button “Next”. Here is another solution:

MonkeyOR.WhatIf5

The only difference with a previous solution is that Harriet rests not on the Grass but near the Stream (sharing this place with Anna). Actually, the What-If Analyzers tells us that there are 69 different solutions and we may navigate through them using buttons “Next” and “Prev”.

Now let’s activate all rules “MonkeyUseDifferentRestingPlaces” by checking their Active status:

MonkeyOR.WhatIf6

What-If Analyzer will immediately produce the only possible solution:

MonkeyOR.WhatIf7

It happens even before we click on the button “Solution” (by a pure propagation of all active rules/constraints). If you click on the “Next”, it will show the same solution with the comment “Found Solution #1 out of 1“.

We may activate/deactivate different rules considering all possible situations, and What-If Analyzer will immediately produce the proper solutions or will point to conflicts among active rules.

This example demonstrates how our What-If Analyzer  helps decision modelers to analyze their decision models in real-time.

Advertisements

About jacobfeldman

CTO at www.openrules.com http://www.linkedin.com/in/jacobfeldmanopenrules
This entry was posted in Decision Management, Constraint Programming, Tools and Technologies, DMN, Use Cases. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s