Challenge May-2020

Pay-As-You-Go Pricing                                                                                           Solutions

SaaS (Software as a Service) is taking over the cloud computing market. It offers pay-as-you-go pricing models that enable customers to pay only for what they use. Here is an example of pricing rules when your monthly bill is determined by the number of units (e.g. executed transactions) you actually use by tiers:

Tiers Units Cost
Free Tier The first 10,000 units are free $0 / unit
Tier 1 Up to 20,000 units per month $0.050 / unit
Tier 2 From 20,000 to 50,000 units per month $0.030 / unit
Tier 3 Above 50,000 units per month $0.010 / unit

Now assume that you are a vendor of a SaaS product that needs to report the actual use of your product to the cloud provider in accordance with the above rules. For example, AWS requires each SaaS vendor to accumulate the actual use per customer and report the charged amount to the AWS metering system every hour by tiers. So, you need to create a pricing decision service that implements these rules. Your service will be called at the beginning of each hour and will receive 3 parameters:

  • Number of all used units (from the very first use until the last hour including)
  • Number of units used this month (the last hour including)
  • Number of units used the last hour.

Your pricing service should produce the numbers of charged units for Tier 1, Tier 2, and Tier 3 for the last hour. Here are examples:

All units This month units Last hour units Tier  Tier  2  Tier 3 
2,000 2,000 160 0 0 0
10,200 10,200 350 200 0 0
25,600 8,678 1,234 1,234 0 0
1,500 1,500 1,500 0 0 0
22,000 22,000 20,500 8,500 2,000 0
32,500 32,500 10,500 0 10,500 0
55,600 20,500 700 200 500 0
85,600 25,700 1,500 0 1,500 0
120,258 60,390 2,350 0 0 2,350
120,000 120,000 120,000 10,000 30,000 70,000

We challenge you to implement this decision service with your favorite tool, test it (!), and submit your solutions with execution results to  DecisionManagementCommunity@gmail.com.

Solutions: