public DBscanCluster() { this.pointsList = new List <CabMetaData>(); this.cabNameList = new List <string>(); cabInOrNotList = new ClusterBitList(); assigned = false; matched = false; k = 0; this.clusterId = idCount; idCount++; }
//NewMC方法使用:给定新增集合,判断是否继续满足moving cluster条件,即两者之间共有的元素是否超过一定比例(theta);使用位数组进行判断 public bool IsNewMovingClusterByBitList(int intersection, DBscanCluster cluster) { //double intersection = ClusterBitList.IntersectBetweenClusters(this.currentCluster.CabInOrNotList, cluster.CabInOrNotList); double union = ClusterBitList.UnionBetweenClusters(this.currentCluster.CabInOrNotList, cluster.CabInOrNotList); if (intersection / union >= theta1) { return(true); } else { return(false); } }
public DBscanCluster(List <CabMetaData> pointsList) { this.pointsList = pointsList; this.cabNameList = new List <string>(pointsList.Count); this.cabInOrNotList = new ClusterBitList(pointsList); foreach (CabMetaData cabMetaData in pointsList) { this.cabNameList.Add(cabMetaData.CabName); } Assigned = false; matched = false; k = 0; this.clusterId = idCount; idCount++; }
//两集合求并集,返回并集中元素个数 static public double UnionBetweenClusters(ClusterBitList cluster1, ClusterBitList cluster2) { BitArray b3 = new BitArray(cluster1.objectList); BitArray b4 = new BitArray(cluster2.objectList); BitArray result = new BitArray(b3.Or(b4)); double resultCount = 0; foreach (bool bit in result) { if (bit) { resultCount++; } } return(resultCount); }