Decision “Make a Good Burger” published an interesting June-2015 Challenge called “Make a Good Burger“. Below I describe an OpenRules-based decision model that provides various solutions for this problem. Here is the problem description:


To create the proper decision model I used only business-oriented decision tables in the simple Excel format supported by OpenRules Rule Solver.  As usual with OpenRules, I freely introduced various decision variables in plain English and placed them in the following glossary:


Defining the domain “1-5” of the main item variables, I’ve already specified that “You must include at least one of each item and no more than five of each item “.

I’ve also added 4 variables for different burger’s totals.  The upper bounds of their domains already enforce the final burger containment requirements:

  • Less than 3000 mg of sodium
  • Less than 150 grams of fat
  • Less than 3000 calories.

These total-variables may be defined as scalar products of the proper values from the ingredient list above and all (yet unknown) variables. It can be easily done in the following decision table thanks to the standard OpenRules decision table templates:


I expressed all costs in cents. The only remaining rules are the serving requirements:

  • you’ll need to keep the servings of ketchup and lettuce the same
  • you’ll need to keep the servings of pickles and tomatoes the same.

It can be easily done in the following decision table that is hopefully self-explanatory:


To complete and execute this decision model we need to define a data type Burger


and at least one test-variable of this type:


The main decision “MakeBurger” now can be presented as follows:


You may look at the complete file DecisionBurgerRecipe.xls that contains all necessary tables.

Now we will launch OpenRules to check if our model is correct and may produce at least one solution. We will use the default Java launcher:


It generates one solution with the total cost 72 cents:


Then I tried to generate all possible solutions. So, I slightly modified the launcher:


Here I set the decision’s parameter “MaxSolutions” to 6000, executed the same decision model, and just added a loop to print all found solutions. In a few seconds OpenRules generate all 5052 solutions. Here are the last 3 printed solutions:


And finally to find a solution that maximizes the Total Cost I used the following Launcher:


that produced the optimal solution:


Here is the execution statistics for this run:


You will find the entire working project “DecisionBurgerRecipe” in the next release of OpenRules Solver.


About jacobfeldman

CTO at
This entry was posted in Constraint Programming, Decision Management, Use Cases. Bookmark the permalink.

2 Responses to Decision “Make a Good Burger”

  1. meparish says:

    Hi Jacob, I noticed that Openrules found 5202 solutions whereas Corticon found 5192 solutions. Looks like the difference is attributable to the fact that you are comparing less than OR equal for the sodium, fat and calorie limits. With strictly less than (which is what the problem specifies) you get 5192 solutions. When I changed Corticon to <= I got the same results as you. So Corticon burgers are slightly healthier, I guess! Mike

  2. jacobfeldman says:

    Thank you, Mike. Yes, when we define variable domains the lower and upper bounds are included. Have you tried to maximize not the total cost but rather the total number of all items?
    By the way, soon we are going to introduce a dynamic graphical interface for decision models allowing an end user to activate/deactivate various rules and immediately see how it effects all problem variables and then to generate various solutions including the optimal ones. The burger problem will provide a nice use case for this interface. Stay tuned!

Leave a Reply

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

You are commenting using your 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