fixed clustering algorithm