Cluster2

Top  Previous  Next

This function solves the problem of clustering customers (with weights defined through demands property), so total distance between cluster center and customers is minimized.

 

Cost is defined through a matrix, which can be calculated by TCalc.Matrix, TCalc.MatrixDyn, TNetwork.Matrix, TNetwork.MatrixDyn or on your own.

 

If Demand parameter is nil (not set), the algorithm assumes 1 for all customers.

 

You can also call the function with NCluster = 1, if you just want to find the weighted center.

 

The function do not return any values, but populates these properties:

 

Property Assignment holds a number in the range 0 .. NCluster-1 about the cluster ID.

Property Center holds information about which customer is the center of the cluster.

 

Property

Dimension

Demand (used as weight)

No of customers

Matrix

No of customers x customers

Assignment (output)

No of customers

Center (output)

No of clusters

 

Sample calculation time:

 

Customers

No of clusters

Calculation time (msec)

100

10

32

1000

1

16

1000

10

47

1000

100

31

10000

10

3219

10000

100

3532

10000

1000

2422

20000

100

11891

20000

1000

8391

 

Syntax: Cluster2(NCluster: integer);