private void MarkKeyCells()
        {
            rows.Reverse();
            table.BestTableObjects.Reverse();
            DynamicTableObject firstTableObject = null;
            DynamicTableObject lastTableObject  = null;
            int previousGroup = -1;
            int row           = 0;

            for (int rowIndex = 0; rowIndex < rows.Count; rowIndex++)
            {
                int col = table.BestTableObjects[rowIndex];
                DynamicTableObject tableObject = table.TableObjects[col];
                if (firstTableObject == null)
                {
                    firstTableObject = tableObject;
                }
                if (rowIndex == rows.Count - 1)
                {
                    lastTableObject = tableObject;
                }
                lbBest.Items.Add(table.GroupNames[tableObject.GroupIndex] + ": " + tableObject.ToString());

                if (previousGroup == -1)
                {
                    previousGroup = tableObject.GroupIndex;
                }
                else
                {
                    for (int previousIndex = previousGroup + 1; previousIndex < tableObject.GroupIndex; previousIndex++)
                    {
                        int previousCol = table.GroupMaxIndices[previousIndex][row];
                        gridMain.Rows[row].Cells[previousCol + 1].Style.BackColor = Color.Yellow;
                    }
                    previousGroup = tableObject.GroupIndex;
                }
                row = rows[rowIndex];
                Color color;
                if (rowIndex != rows.Count - 1)
                {
                    color = Color.Green;
                }
                else
                {
                    color = Color.Red;
                }

                gridMain.Rows[row].Cells[col + 1].Style.BackColor = color;
            }

            if (firstTableObject != null && firstTableObject.GroupIndex != 0)
            {
                for (int previousGroupIndex = 0; previousGroupIndex < firstTableObject.GroupIndex; previousGroupIndex++)
                {
                    int previousCol = table.GroupMaxIndices[previousGroupIndex][0];
                    gridMain.Rows[0].Cells[previousCol + 1].Style.BackColor = Color.Yellow;
                }
            }

            if (lastTableObject != null && lastTableObject.GroupIndex != table.GroupNames.Count - 1)
            {
                for (int afterGroupIndex = lastTableObject.GroupIndex + 1; afterGroupIndex < table.GroupNames.Count; afterGroupIndex++)
                {
                    int afterCol = table.GroupMaxIndices[afterGroupIndex][row];
                    gridMain.Rows[row].Cells[afterCol + 1].Style.BackColor = Color.Yellow;
                }
            }

            tbBestValue.Text = table.BestValue.ToString();
            tbBestCost.Text  = table.BestCost.ToString();
        }