Do you know you can pay less for MPESA transactions? (using linear programming models)

MPESA is now ubiquitous, and if you do most our your transactions on MPESA then you must have worried at times, whether you could pay less for your MPESA transactions. If you worry, like most Kenyans, about “pesa ya kutoa” (withdrawal fees) then this is for you.

Linear programming is a method to achieve the best outcome (such as maximum profit or lowest cost) in a mathematical model whose requirements are represented by linear relationships. In its basic form, linear programming involves setting relationships between various factors and also setting conditions or rules for to evaluate. In essence, its like solving simultaneous equations to meet certain conditions (do not worry, you are not going to solve any equations yourself, Excel will do it for you)

MPESA transactions seemed like a good fit for this kind of modeling because, as you can see from the chart below, the transaction fees seems to have a linear relationship with the amounts to be transacted.

New Picture

The chart also tells us that we are better off optimizing the withdrawal fees rather than the sending fees because of high variation in the transaction fees.

The modelling

The transaction fees I used are the most recent published by Safaricom. Below!

New Picture (1)

 

The main condition for the modeling was that I cannot repeat a similar transaction more than 5 times i.e, say to send 1000, I cannot send the money in batches of say shs 50 until I get to 1000 (20 times). This was mainly for the solution to be more practical. Another condition was that I had to send/withdraw exactly the amount I specify, not less or more.

Linear Programming with Excel Solver addin

Excel has an optional addin to help you solve linear optimization problems. Once enabled, you will be able to run LP models (you can see how to enable it here). The solver addin in Excel (and most of the what-if analysis tools) are probably the least used addins in Excel. Anyhow once installed, you will find it in the data tab of excel

New Picture (4)

My model

I created a model that covers amounts up to 25000 because this is where there is a lot of variation in the transaction fees. My data was set up as below.

Capture

My objective function (to minimize the cost of withdrawal) is highlighted in Green. The model would work iterations on number (column E) to arrive at an optimized solution for withdrawing the amount specified. The model window looks like:

New Picture (2)

After running the model, you get the decision by filtering for non-zero values in the “numbers” column.

New Picture (3)

For the above, the model suggest that if you want to send withdraw 10100 cheaply, then you are better off withdrawing 2500 four times and then withdrawing shs 10 for a maximum of Shs 118 in transaction fees compared safaricoms Shs 159 (you save about Shs 41).

You can download the model and try different values for the amount for yourself. Download it here. (Note: some values take some time (up to 6 minutes) to compute because the model is large (65+ variables to test and optimize).

Some results:

Amount MPESA RATE MODEL RATE
5000 60 54
10100 159 118
12500 145 135
4000 60 54

 

 

About the author

levisdoban

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *