Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var    att    = Convert.ToInt32(textBox7.Text);
            var    Region = Convert.ToInt32(textBox10.Text);
            Series ser3   = new Series("Attempts statistics");

            chart4.Series.Clear();

            var alpha = Convert.ToDouble(textBox12.Text);

            SortedDictionary <double, double> dict = new SortedDictionary <double, double>();

            for (int i = 0; i < att; i++)
            {
                var result = new VariableDepthSearch().VariableDepthSearchMethod(knapsackModel, Region, alpha);
                if (!dict.ContainsKey(result.ResultC))
                {
                    dict.Add(result.ResultC, 1);
                }
                else
                {
                    dict[result.ResultC] += 1;
                }
            }
            foreach (var pair in dict)
            {
                ser3.Points.AddXY(pair.Key.ToString(), pair.Value.ToString());
            }

            chart4.Series.Add(ser3);
            chart4.ChartAreas[0].AxisX.Interval = 1;
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            File.Delete(@"C:\Users\User\Downloads\ResultVariableDepth.txt");

            var alpha  = Convert.ToDouble(textBox12.Text);
            var Region = Convert.ToInt32(textBox10.Text);

            var result = new VariableDepthSearch().VariableDepthSearchMethod(knapsackModel, Region, alpha);

            textBox9.Text = Convert.ToString(result.ResultC);
            textBox8.Text = Convert.ToString(result.ResultW);
            listBox2.Items.Clear();

            var sb = new StringBuilder();

            for (int i = 0; i < result.X.Count; i++)
            {
                char c = result.X[i] ? '1' : '0';
                sb.Append(c);
            }
            listBox2.Items.Add(sb.ToString());
        }