planClusters: plan less cluster than numberOfClusters

Deals with clustering based on locations but also on time regularity.
Post Reply
Prakash
Posts: 22
Joined: Mon Sep 14, 2015 5:21 am

planClusters: plan less cluster than numberOfClusters

Post by Prakash »

Hello,

I have a usecase regarding planClusters method. We get exception when we provide numberOfClusters attribute value less than number of clusters set in the requests. Please see below exception message:
Encountered invalid request: Passed more fixed clusters than number of clusters asked to return. Number of fixed clusters: 2 Requested clusters: 1.
My expectation, PTV should create same amount of cluster as provided in numberOfClusters by choosing the best suitable clusters from the request and ignore the extra ones.
Could you please suggest, how can I achieve my expectation using planClusters method?

regards,
Prakash
Prakash Kumar
Developer
Webdirekt India Pvt. Ltd.
User avatar
Bernd Welter
Site Admin
Posts: 2574
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: planClusters: plan less cluster than numberOfClusters

Post by Bernd Welter »

Hi Prakash,

this is easy to solve:
If the number of input clusters (e.g. 4) is higher than the desired number of output clusters (e.g. 2) you have to specify some of the input clusters as "optional". To do this you have to set the optionalClusterIDs in the PlanClustersOptions.

Example:
  • Imagine to have four input clusters: Alpha (=your head quarter), Bravo, Charlie, Delta
  • Finally you want to have only 3 clusters in total.
  • Alpha should be fixed because it is the head quarter.
  • Any one of the three other input clusters Bravo, Charlie, Delta is a candidate for the cut.
To solve this you have to proceed as follows:
  • Provide the 4 clusters as input clusters
  • Provide planClustersOptions.optionalClusterIDs = ["Bravo","Charlie","Delta"]
    As you can see in the map: there are two adjacent input clusters (blue pins) in the south west. The output shows that Charlie has been sacrificed.
    As you can see in the map: there are two adjacent input clusters (blue pins) in the south west. The output shows that Charlie has been sacrificed.
Special case:
  • Case 1: Provide all input cluster IDs as optional: none of the clusters is fixed.
  • Case 2: Number of optionalClusterIDs == (numberOfInputClusters - numbeOfClusters): all optional clusters will be sacrificed - there's no real choice.
  • Case 3: If the number of desired output clusters is greater than the number of input clusters and no candidates are given then we will pick some of the customer locations as potential new clusters.
    4 new clusters have been recommended. Their IDs are created as GUIDs.
    4 new clusters have been recommended. Their IDs are created as GUIDs.
Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply