public void MakeCentroid() { Shoots members = new Shoots(); members.AddRange(allShoots); int clsLen = members.Count / clusters.Length; //エルボー法評価のため double distSumAllShoots = 0; string distSumAllShootsOutput = "distSumAllShoots.csv"; foreach (Cluster c in clusters) { c.centroid.DBAacc = (Vec3[])members[0].acc.Clone(); c.members.Add(members[0]); for (int i = 1; i < clsLen; ++i) { double minDist = double.MaxValue; Shoot minS = null; foreach (Shoot s in members) { DBA.CostPath cp; cp = DBA.DpMatching(s.acc, c.centroid.DBAacc); //to callback in DBA-DBA distance //myDBShoots.Add(new DBAShoot()); //最終コストが距離 double dist = cp.cost[cp.cost.Length - 1][cp.cost[cp.cost.Length - 1].Length - 1]; s.distFromCentroid = dist; //エルボー法評価のため全ての距離の和を求める distSumAllShoots += dist; if (dist < minDist) { minDist = dist; minS = s; } } members.Remove(minS); c.members.Add(minS); } } File.WriteAllText(distSumAllShootsOutput, distSumAllShoots.ToString()); }
public virtual void RemoveShoot(Shoot shoot) { Shoots.Remove(shoot); }