/// <summary>
        /// Calculates ratings
        /// </summary>
        public void CalculateRatings()
        {
            _ratings = new Dictionary<int, MaxCoefficient>();
            var rowsCount = _rows.Count;

            foreach (var variableId in _allVariables.Keys)
            {
                var rating = new MaxCoefficient();
                for (var rowIndex = 0; rowIndex < rowsCount; rowIndex++)
                {

                    var tmp = new MaxCoefficient(_targetFunctionCoefficients[_basisVariables[rowIndex]]);
                    var fraction = new Fraction(_rows[rowIndex].ElementAt(variableId));
                    tmp.Multiply(fraction);
                    rating.Add(tmp);
                }
                rating.Subtract(_targetFunctionCoefficients[variableId]);
                _ratings.Add(variableId, rating);
            }
            FunctionValue = CalculateFunctionValue();
        }
 /// <summary>
 /// Returns index of solving cell(or -1 if table has no positive rating)
 /// </summary>
 /// <param name="table">Table with calculated ratings</param>
 /// <param name="solvingRowIndex">Index of solving row</param>
 private int GetSolvingCellIndex(SimplexTable table, int solvingRowIndex)
 {
     if (solvingRowIndex < 0) return -1;
     var minRatioIndex = -1;
     var minRatio = new MaxCoefficient();
     for (var i = 0; i < table.Variables.Count; i++)
     {
         var matrixElement = table.GetMatrixElement(solvingRowIndex, i);
         if (matrixElement >= 0) continue;
         var rating = table.Ratings[i];
         var currRatio = new MaxCoefficient(rating);
         currRatio.Multiply(1 / matrixElement);
         if (currRatio.CompareTo(minRatio) != -1 && minRatioIndex != -1) continue;
         minRatioIndex = i;
         minRatio = currRatio;
     }
     return minRatioIndex;
 }
 /// <summary>
 /// Gets function value
 /// </summary>
 public MaxCoefficient CalculateFunctionValue()
 {
     var tmpResult = new MaxCoefficient();
     foreach (var elem in _basisVariables)
     {
         var varCoefficient = new MaxCoefficient(_targetFunctionCoefficients[elem.Value]);
         var varValue = new Fraction(_freeCoefficients[elem.Key]);
         varCoefficient.Multiply(varValue);
         tmpResult.Add(varCoefficient);
     }
     return tmpResult;
 }