예제 #1
0
        public AlgoResults Calculate(List <int> Product_in_total, List <int> Product_in_Command, List <int> inputdata, List <Fabric> fabrics)
        {
            Stopwatch watch = new Stopwatch();

            watch.Start();
            Hive hive    = new Hive(fabrics, Product_in_Command);
            Bee  bestBee = hive.Solve();
            var  res     = new List <bool>();

            foreach (var b in bestBee.plan)
            {
                res.Add(System.Convert.ToBoolean(b));
            }
            watch.Stop();
            return(new AlgoResults(res.ToArray(), bestBee.LCF, watch.ElapsedMilliseconds));
        }
예제 #2
0
            public static Matrix Simulate()
            {
                int totalNumberBees = 100;
                int numberInactive  = (int)(.20 * totalNumberBees);
                int numberActive    = (int)(.50 * totalNumberBees);
                int numberScout     = (int)(.30 * totalNumberBees);

                int maxNumberVisits = 100;
                int maxNumberCycles = 30000;

                msg = new StringBuilder();

                Hive hive = new Hive(numberInactive, numberActive, numberScout, maxNumberVisits, maxNumberCycles);

                hive.Solve();
                MessageBox.Show(msg.ToString());

                double score = hive._bestMatrix.Score();

                Matrix.EndOptimization();

                return(hive._bestMatrix);
            }