Beispiel #1
0
        static void Main(string[] args)
        {
            String        filename          = @"C:\Users\Augusto Baffa\workspace\FixedCostTransportationGame\rsc\test\N104.DAT";
            FCTPGraph     g                 = InstanceConverter.convert(filename);
            RuntimeSolver solver            = new RuntimeSolver();
            Dictionary <EdgePair, double> l = solver.Solve(g);

            foreach (EdgePair ep in l.Keys)
            {
                Console.Out.WriteLine(ep.ToString() + "\t" + l[ep]);
            }
        }
Beispiel #2
0
        public void matchOn(FileInfo child, List <string> players)
        {
            FCTPGraph problem =
                InstanceConverter.convert(
                    child.FullName);

            log("Match " + problem.Name);

            //Initialize Edge Auction
            EdgeAuction auction = new EdgeAuction(problem, GamePlay.U, players); // GamePlay.U - Gets Constant Factor K = 20 (U = K on problem description)

            //int edgesPerRound = computeEdgesPerRound(problem, players.Count);
            //log(edgesPerRound + " edges per round");

            //String msg = "instance " + problem.Name + " " + edgesPerRound;
            playRound(child.Name, auction, GamePlay.round); // GamePlay.round - Gets the current round number.

            Dictionary <String, Double> instancePayoffs = auction.getPayoffMap();

            foreach (HandleClient c in GamePlay.socket.ClientList) // GamePlay.socket.ClientList - Gets list of players
            {
                String s = c.player.name;

                if (instancePayoffs.ContainsKey(c.player.name))
                {
                    c.player.SetScore(instancePayoffs[s]);

                    if (!payoffs.ContainsKey(s))
                    {
                        payoffs.Add(s, instancePayoffs[s]);
                    }
                    else
                    {
                        payoffs[s] = payoffs[s] + instancePayoffs[s];
                    }
                }
            }

            log("PARTIAL");
            String partial = getSortedPayoffMapMsg(payoffs);

            log(partial);
        }