Пример #1
0
        private static void Main(string[] args)
        {
            var env = new ConcurrentEnvironment();

            for (int i = 1; i <= 3; i++) // Utils.MaxLevel
            {
                for (int j = 1; j <= 3; j++)
                {
                    for (int k = 1; k <= 3; k++)
                    {
                        var workerAgent = new WorkerAgent(i, j, k);
                        env.Add(workerAgent, string.Format("worker{0}{1}{2}", i, j, k));
                        workerAgent.Start();
                    }
                }
            }

            var calculatorAgent = new CalculatorAgent();

            env.Add(calculatorAgent, "shapley");
            calculatorAgent.Start();

            Thread.Sleep(100);

            var managerAgent = new ManagerAgent();

            env.Add(managerAgent, "manager");
            managerAgent.Start();

            env.WaitAll();
        }
Пример #2
0
        private static void Main(string[] args)
        {
            var env = new EnvironmentMas(1000);

            for (int i = 1; i <= 3; i++) // MaxLevel
            {
                for (int j = 1; j <= 3; j++)
                {
                    for (int k = 1; k <= 3; k++)
                    {
                        var workerAgent = new WorkerAgent(i, j, k);
                        env.Add(workerAgent, $"worker{i}{j}{k}");
                    }
                }
            }

            var calculatorAgent = new CalculatorAgent();

            env.Add(calculatorAgent, "shapley");

            var managerAgent = new ManagerAgent();

            env.Add(managerAgent, "manager");

            env.Memory.Add("NoAttributes", 3);
            env.Memory.Add("MaxLevel", 3);
            env.Memory.Add("NoTasks", 100);
            env.Memory.Add("NoBids", 3);

            env.Start();
        }