Exemplo n.º 1
0
        private void AddToSecondList(int[][] table, ListBox listBox)
        {
            int[][] matrix = Algorithm.matrixMethod(table);
            listBox.Items.Clear();
            listBox.Items.Add(Gran(spaces - 2, spaces * 2 + 1, table[0].Length + 2));
            string str = "";

            str += "|" + "di" + Spaсes(spaces - "di".Length - 2) + "|";
            for (int i = 0; i < table[0].Length; i++)
            {
                str += "S" + (i + 1).ToString() + Spaсes(spaces * 2 - (i + 1).ToString().Length) + "|";
            }
            str += "Tож" + Spaсes(spaces * 2 - 2) + "|";
            listBox.Items.Add(str);
            listBox.Items.Add(Gran(spaces - 2, spaces * 2 + 1, table[0].Length + 2));
            for (int i = 0; i < table.Length; i++)
            {
                str  = "";
                str += "|" + (i + 1).ToString() + Spaсes(spaces - (i + 1).ToString().Length - 2) + "|";
                for (int j = 0; j < table[0].Length; j++)
                {
                    str += table[i][j].ToString() + Spaсes(spaces - table[i][j].ToString().Length) + "/" +
                           matrix[i][j].ToString() + Spaсes(spaces - matrix[i][j].ToString().Length) + "|";
                }
                str += matrix[i][matrix[0].Length - 1].ToString() + Spaсes(spaces * 2 - matrix[i][matrix[0].Length - 1].ToString().Length + 1) + "|";
                listBox.Items.Add(str);
            }
            str  = "";
            str += "|" + "Tп" + Spaсes(spaces - 4) + "|";
            for (int i = 0; i < matrix[0].Length - 1; i++)
            {
                str += matrix[matrix.Length - 1][i].ToString() + Spaсes(spaces * 2 - matrix[matrix.Length - 1][i].ToString().Length + 1) + "|";
            }

            int sum1 = 0,
                sum2 = 0;

            for (int i = 0; i < matrix.Length - 1; i++)
            {
                sum1 += matrix[i][matrix[0].Length - 1];
            }
            for (int i = 0; i < matrix[0].Length - 1; i++)
            {
                sum2 += matrix[matrix.Length - 1][i];
            }
            str += sum2.ToString() + Spaсes(spaces - sum1.ToString().Length) + "\\" +
                   sum1.ToString() + Spaсes(spaces - sum2.ToString().Length) + "|";

            listBox.Items.Add(str);
            listBox.Items.Add(Gran(spaces - 2, spaces * 2 + 1, table[0].Length + 2));
        }
Exemplo n.º 2
0
        private void loadDataButton_Click(object sender, EventArgs e)
        {
            oldTable = loadFromFile("input.dat");
            bestNum  = Algorithm.Sort(oldTable);
            currNum  = bestNum;
            tables   = Algorithm.allTables(oldTable);
            comboBox1.SelectedIndex = currNum;

            opt1.Select();
            AddToFirstList(oldTable, table1);

            int[][] tmp1 = Algorithm.matrixMethod(oldTable);

            answerLabel1.Text = "Время простоя: " + Max(tmp1[tmp1.Length - 1]).ToString();
        }
Exemplo n.º 3
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     currNum = comboBox1.SelectedIndex;
     int[][] tmp2 = Algorithm.matrixMethod(tables[currNum]);
     AddToSecondList(tables[currNum], table2);
     answerLabel2.Text = "Время простоя: " + Max(tmp2[tmp2.Length - 1]).ToString();
     if (currNum == bestNum)
     {
         answerLabel2.BackColor = Color.LightGreen;
     }
     else
     {
         answerLabel2.BackColor = Color.LightGray;
     }
 }
Exemplo n.º 4
0
 public Graphic(int[][] _table, int[] _sequence)
 {
     table     = _table;
     sequnce   = _sequence;
     tmp       = Algorithm.matrixMethod(table);
     downtimes = countDowntimes();
     InitializeComponent();
     Color[] colors = GetColors();
     ListView.ListViewItemCollection items = detailsViewBox.Items;
     items.Add("Простой");
     items[0].BackColor = colors[0];
     for (int i = 0; i < sequnce.Length; i++)
     {
         items.Add((sequnce[i] + 1).ToString() + "-я деталь").BackColor = colors[sequnce[i] + 1];
     }
 }