/// <summary>
 /// Returns index of solving row(or -1 if solving row has no positive elements or solvingCellIndex == -1)
 /// </summary>
 private int GetSolvingRowIndex(SimplexTable table, int solvingCellIndex)
 {
     if (solvingCellIndex < 0) return -1;
     var minRatioIndex = -1;
     var minRatio = new Fraction();
     for (var i = 0; i < table.RowsCount; i++)
     {
         var matrixElement = table.GetMatrixElement(i, solvingCellIndex);
         if (matrixElement <= 0) continue;
         var freeCoefficient = table.GetFreeCoefficient(i);
         var currRatio = freeCoefficient / matrixElement;
         if (currRatio >= minRatio && minRatioIndex != -1) continue;
         minRatioIndex = i;
         minRatio = currRatio;
     }
     return minRatioIndex;
 }
 /// <summary>
 /// Returns index of solving row(or -1 if solving row has no positive elements or solvingCellIndex == -1)
 /// </summary>
 private int GetSolvingRowIndex(SimplexTable table)
 {
     var minFreeCoefficientIndex = -1;
     for (var i = 0; i < table.RowsCount; i++)
     {
         if (minFreeCoefficientIndex == -1)
         {
             if (table.GetFreeCoefficient(i) < 0)
                 minFreeCoefficientIndex = i;
             continue;
         }
         if (table.GetFreeCoefficient(i) < table.GetFreeCoefficient(minFreeCoefficientIndex))
             minFreeCoefficientIndex = i;
     }
     return minFreeCoefficientIndex;
 }