I have Coordinates data-set (X.Y) with an additional attribute "Z". I wanna to cluster the data to 5 clusters based on (X&Y) but I want to add some constrains on how much the sum of "Z" can be at each cluster. How can I do that?
Your question needs more details such as what these data represents (is it an image? is it a digital elevation model?...etc). What constraints do you want to add? is there a specific clustering algorithm in mind?
Normally, if this data represents an image, the clustering is based on the value of Z where Z in this case is the grey level value. Moreover, the position of the pixels (X,Y) are maintained, but each pixel is assigned to a specific cluster based on some conditions and constraints.
x, y represents coordinates of highways center lines and Z represents the cost to repair each highway. The target is to group the roads that are closed to each other to be repaired in same
If you're relying on Z in your task, then it's reasonable to convert the cluster problem into a classification one. Another option is to use Z to cluster the data (an evaluation approach).
In this case as I said use any clustering algorithm such as K-Means, FCM, SOMs to cluster these data based on the Z values. When you get the cluster centers you can use threshold for assigning highways centers to each cluster. e.g. highways centers costs ( 2.5, 3, 1.5, 4.2...etc) cluster centers according to Z values (2.7, 2.8 , 1.7...) then you can set the threshold to be less than or equal to 0.2 as an example which represents the difference between the centers of highways and the cluster centers .