Exemple #1
0
        private void OnBigPropClick(object sender, EventArgs e)
        {
            int n = (int)this.upDownN.Value;

            Trace trace = new Trace(true);

            if (n > 100)
            {
                trace.Flag = false;
            }

            IncrementalMatching instance = new IncrementalMatching(n, random);

            instance.GaleShapley(trace);


            String mString = "mMatching: " + Algorithm.ArrayToString(trace.Matching);
            String wString = "wMatching: " + Algorithm.ArrayToString(Algorithm.InvertPermutation(trace.Matching));


            textBox1.Text = trace.MPrefs + "\r\n\r\n" + trace.WPrefs;

            textBox2.Text = mString + "\r\n" + wString + "\r\n" + RankString(trace);
            textBox3.Text = trace.Result;
        }
Exemple #2
0
        private void OnBigIterateClick(object sender, EventArgs e)
        {
            Trace trace = new Trace(true);
            int   reps  = (int)this.upDownReps.Value;
            int   n     = (int)this.upDownN.Value;

            if (n > 100)
            {
                trace.Flag = false;
            }

            IncrementalMatching instance = new IncrementalMatching(n, random);

            long   mRank   = 0;
            long   wRank   = 0;
            string results = "";

            this.countTextBox.Text = "0";
            this.countTextBox.Refresh();

            for (int i = 0; i < reps; i++)
            {
                instance.GaleShapley(trace);
                results += RankString(trace) + "\r\n";
                mRank   += trace.MRank;
                wRank   += trace.WRank;

                this.countTextBox.Text = i.ToString();
                this.countTextBox.Refresh();
            }

            this.countTextBox.Text = reps.ToString();

            textBox5.Text = results;
            float avgMRank = ((float)mRank) / (reps);
            float avgWRank = ((float)wRank) / (reps);

            textBox4.Text = "Avg MRank: " + avgMRank + " (" + avgMRank / n + ")  Avg WRank: " + avgWRank + " (" + avgWRank / n + ")";
        }