예제 #1
0
        private static void Main(string[] args)
        {
            // inefficient, uses broadcast to simulate public open-cry auction

            var env = new TurnBasedEnvironment(0, 0, false);

            var auctioneerAgent = new AuctioneerAgent();

            env.Add(auctioneerAgent, "auctioneer");

            Random rand = new Random();

            for (int i = 1; i <= Settings.NoBidders; i++)
            {
                int agentValuation = Settings.MinPrice + rand.Next(Settings.MaxPrice - Settings.MinPrice);
                var bidderAgent    = new BidderAgent(agentValuation);
                env.Add(bidderAgent, $"bidder{i:D2}");
            }

            env.Start();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            // more efficient, each bidder only talks to the auctioneer

            var env = new TurnBasedEnvironment(0, 0, false);

            Random rand = new Random();

            for (int i = 1; i <= Settings.NoBidders; i++)
            {
                int agentValuation = Settings.MinPrice + rand.Next(Settings.MaxPrice - Settings.MinPrice);
                var bidderAgent    = new BidderAgent(agentValuation);
                env.Add(bidderAgent, $"bidder{i:D2}");
            }

            var auctioneerAgent = new AuctioneerAgent();

            env.Add(auctioneerAgent, "auctioneer");

            env.Start();
        }
예제 #3
0
        private static void Main(string[] args)
        {
            // inefficient, uses broadcast to simulate public open-cry auction

            var env = new ConcurrentEnvironment();

            for (int i = 1; i <= Utils.NoBidders; i++)
            {
                int agentValuation = Utils.MinPrice + Utils.RandNoGen.Next(Utils.MaxPrice - Utils.MinPrice);
                var bidderAgent    = new BidderAgent(agentValuation);
                env.Add(bidderAgent, string.Format("bidder{0:D2}", i));
                bidderAgent.Start();
            }

            Thread.Sleep(100);

            var auctioneerAgent = new AuctioneerAgent();

            env.Add(auctioneerAgent, "auctioneer");
            auctioneerAgent.Start();

            env.WaitAll();
        }
예제 #4
0
        private static void Main(string[] args)
        {
            // more efficient, each bidder only talks to the auctioneer

            var env = new ConcurrentEnvironment();

            for (int i = 1; i <= Utils.NoBidders; i++)
            {
                int agentValuation = Utils.MinPrice + Utils.RandNoGen.Next(Utils.MaxPrice - Utils.MinPrice);
                var bidderAgent    = new BidderAgent(agentValuation);
                env.Add(bidderAgent, string.Format("bidder{0:D2}", i));
                bidderAgent.Start();
            }

            Thread.Sleep(100);

            var auctioneerAgent = new AuctioneerAgent();

            env.Add(auctioneerAgent, "auctioneer");
            auctioneerAgent.Start();

            env.WaitAll();
        }