How to Plan Clusters
The PTV xCluster server allows you to plan and change clusters and cluster centres based on locations. Locations are for example customer addressesAn address is a textual specification of a location, which consists of different optional parts, e.g the country, state, postal code, one or more localities, street and house number.. A cluster can be a smaller administrative area unit such as a postcode area. Common use cases are in the management of sales representatives, the planning of warehouse locations and their delivery areas and in delivery planning.
The use case plan clusters is used when there is a new area for which clusters should be calculated. It calculates the optimal distribution of the given locations to the specified number of clusters. The result are the clusters and their assigned locations. Each location can only be assigned in one cluster. The cluster center is the coordinate of the calculated middle of the cluster.
Additional information
- The PTV xCluster server does not include geographical functions. For example the geometry of clusters cannot be returned in WKB form.
Benefits
Simple cluster planning with PTV xCluster server offers a range of possibilities
- Planning balanced clusters like according revenue potential or number of households.
- Creating clusters which are geographically compact, based on actual kilometers by road and travel times. To reduce travel time and maximise time with the customer.
- Quick simulation of various planning scenarios ("What would happen if" cases).
Prerequisites
- Installed and licensed PTV xCluster Server.
- High-performance routing A route corresponds to a path of a vehicle through the underlying transport network. The main attributes of a route are the distance and the time that the vehicle travels along the path. network for calculating routes, if applicable.
Programming Guide
In this simple example only locations with their coordinates and the activity are specified in the planClusters request. We would like two clusters which are set in the planClustersOptions. They have the default values. For this calculation the direct distance without a distance matrix or a road network will be used:
var locationA = { "location": { "id": "locationA", "routeLocation": { "$type" : "OffRoadRouteLocation", "offRoadCoordinate": { "x": 5.939532, "y": 49.932788 } } }, "activity": 1 }; var locationB = { "location": { "id": "locationB", "routeLocation": { "$type" : "OffRoadRouteLocation", "offRoadCoordinate": { "x": 6.086895, "y": 49.918391 } } }, "activity": 1 }; var locationC = { "location": { "id": "locationC", "routeLocation": { "$type" : "OffRoadRouteLocation", "offRoadCoordinate": { "x": 6.002422, "y": 49.51459 } } }, "activity": 1 }; xcluster.planClusters({ "planningLocations": [locationA, locationB, locationC], "planClustersOptions": { "numberOfClusters": 2 }, "distanceMode": { "$type": "DirectDistance" } }, planClusterCompleted); function planClusterCompleted(clusterResponse, exception) { var result = ''; for (clusterIdx = 0; clusterIdx < clusterResponse.clusteredLocations.length; clusterIdx++) { result += 'cluster '+ clusterResponse.clusteredLocations[clusterIdx].clusterId + ':'; var locationIds = clusterResponse.clusteredLocations[clusterIdx].locationIds; for (locationIdx = 0; locationIdx < locationIds.length; locationIdx++) { result += ' '; result += locationIds[locationIdx]; } if (clusterIdx < clusterResponse.clusteredLocations.length - 1) { result += ', '; } } print(result); }Related Topics
The following topics might be relevant for this use case.
- See the other use case documentations of cluster planning.
- See route locations documentation for details of the locations.
- Use Distance Matrices for a faster calculation.