DMCommunity Challenge July-2018 “Zoo, Buses, and Kids”

The July’s challenge “Zoo, Buses, and Kids” deals with a very simple optimization problem:
“300 kids need to travel to the London zoo. The school may rent 40 seats and 30 seats buses for 500£ and 400£. How many buses of each to minimize cost?”
Naturally, a constraint solver nicely and easily solves this and more complex constraint satisfaction problems as shown in Philippe Laborie’s solution. When today I saw  a pure SQL solution provided by Damir Sudarevic, I thought that it’s time to model this problem as a business decision model. It would not be as compact as provided solutions, but it should be oriented to business users. 

So, it took me about an hour to do it in OpenRules with Rule Solver. Now I will describe my solution here. You can see the implementation in this Excel file DecisionZooBusesKids.xls. As usual for business decision modeling I started with the business glossary:

The decision variable “Number of Kids” is comes as a known input (300). The decision variables “Number of Buses With 30 Seats” and “Number of Buses With 30 Seats” are our main unknowns, and I decided that their possible domain are between 0 and 30 (to cover at least 900 kids).  There are two more unknown decision variables “Number of All Seats” and “Total Cost” that depend on previous two variables. We need to minimize “Total Cost” while making sure that “Number of All Seats >= Number of Kids”.

Then I introduce an internal Datatype “Problem” in this Excel table:

and defined an instance of the Problem in this Data table:

To define variables “Number of All Seats” and “Total Cost” I used the predefined action “AddScalProd” in the following Excel table:

And finally I specified the main constraint in this table:

Then I added the table Decision

and ran this Java launcher:

It found an optimal solution from the first attempt:

Of course, this decision model does not look elegant if you compare it to models implemented using specialized modeling languages – see for example OPL and DoCplex. However, it uses the basic decision modeling constructs familiar to our business users.

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.