public void Calculate(int scoutsCount, int goodSitesCount, int bestSitesCount, int neighboursForGoodSites, int neighboursForBestSites) { values = new List<double>(); colonies = new List<BeesColony>(); foreach (Cluster cluster in clusters) { if (cluster.Nodes.Count == 0) { continue; } BeesColony colony = new BeesColony(); colony.Problem = BeesColony.ProblemType.VRP_TSP; colony.ClustersCount = 1; colony.IsCalcLastChange = true; colony.ScoutsCount = scoutsCount; colony.GoodSitesCount = goodSitesCount; colony.BestSitesCount = bestSitesCount; colony.NeighboursForGoodSites = neighboursForGoodSites; colony.NeighboursForBestSites = neighboursForBestSites; List<Node> colonyNodes = new List<Node>(); colonyNodes.AddRange(cluster.Nodes); if (cluster.Depot != null) { colonyNodes.Add(cluster.Depot); } colony.SetNodes(colonyNodes); colony.CreateSites(); colony.IterateToStop(); values.Add(colony.Value); colonies.Add(colony); } Stop(); }
public static void StartBeesAlgorithm(BeesColony.ProblemType problemType, int clustersCount, int scoutsCount, int goodSitesCount, int bestSitesCount, int neighboursForGoodSites, int neighboursForBestSites, int clusterCapacityLimit = -1, double kilometerCost = 0) { BeesColony colony = new BeesColony(); colony.Problem = problemType; colony.ClustersCount = clustersCount; colony.ClusterCapacityLimit = clusterCapacityLimit; colony.KilometerCost = kilometerCost; colony.ScoutsCount = scoutsCount; colony.GoodSitesCount = goodSitesCount; colony.BestSitesCount = bestSitesCount; colony.NeighboursForGoodSites = neighboursForGoodSites; colony.NeighboursForBestSites = neighboursForBestSites; colony.SetNodes(Nodes); colony.CreateSites(); SetAlgorithm(colony); }