Machine learning

Optimizing Cash Recycler Machine Location

K-Means Clustering

4 min readFeb 18, 2021



Cited from ARCA website “A cash recycler is a complex machine that handles a couple of simple, but important tasks — accepting and dispensing cash. It also stores money securely, keeps an accurate accounting of cash on hand, and automates the cash cycle. Generally, you’ll find them in banks, credit unions and back-office retail cash rooms” (ARCA, n.d.).

CRM (Cash Recycler Machine) provided by local banks in Indonesia puts a convenience for their customers to withdraw and deposit their money wherever they want as long there’s a CRM around. CRM also reduces bank operational cost by reducing the need to refill the cash into the old ATM (Automated Teller Machine). But in order to have low maintenance for refilling or taking out the cash form the machine CRM needs a stable cash inflow and outflow. This will be only achievable when there’s an equal withdrawal and deposit transaction.

By placing CRM in business commerce / where the business is proliferating a cash recycling is ensured. A business commerce can deposit their daily transaction directly through CRM and the customer can withdraw their money from CRM as well. With this kind of traffic a recycling stability is ensured and requires low refilling maintenance.

Problem and Interest

Currently in Surabaya, Indonesia CRM isn’t as widespread as the ATM but local banks are planning to replace all of the ATMs with CRMs. To create efficient cash recycling, strategic placement is a mandatory. This project aims to optimize placement for CRMs.


Data collection

Latitude and longitude data of business, venues and commerce in Surabaya acquired using foursquare API. By utilizing explore API in hexagon grid pattern we can maximize API call limitation of 950 regular calls per day.

Hexagon Grid Search

First 30 x 20 hexagon grid is prepared with each of the hexagon radius is 300 meter away from its centroid as seen below. Hexagon grid search is used because it covers the maximum amount of area using a radius based search (circle).

Hexagon layout

After the grid is deployed, iterative search is conducted using foursquare explore API to find local business within 300 meter radius. The business and venues coordinate then captured into csv for further analysis. Over 3.819 businesses and venues are gathered using this method as seen below.

All businesses and venues


Latitude and Longitude Conversion

After all of the business and venues were gathered, K means Clustering is used for segmenting all data points into separate clusters using x y coordinates. The problem is foursquare explore API returns latitude and longitude value instead of Universal Transverse Mercator or UTM or as we know it as Cartesian coordinates. By applying UTM library conversion can be done easily and ready for clustering as seen on ‘x’ and ‘y’ below.

x and y from latitude and longitude

K-means clustering

Clustering is executed by using x and y Cartesian coordinates data and segmenting it for n clusters. Then the centroid of the cluster is retrieved to get an optimal location for the CRMs as shown by the number inside the large circle below.

Analysis & Result

N centroids were chosen as a baseline for analysis and the circle is drawn with radius 1km to visualize 1km coverage. The result is shown below.


As we can see N=50 creates good compromise coverage for dense clusters that clutter together while keeping sparse clusters well covered within 1km radius.


With 50 CRMs deployed around the centroid of the cluster, we can serve most of the business and venues while maintaining a low number of CRMs. Almost all of the CRMs are within reach of 1km inside the clusters or 10–15 minutes walk from the furthest point of the cluster.


Deployment of 50 CRMs within the centroid of the cluster can maximize coverage within 1km radius. Low number of CRMs greatly reduce operational cost whilst maintaining maximum coverage.


ARCA. (n.d.). Cash Recycling. ARCA.,back%2Doffice%20retail%20cash%20rooms.