示例#1
0
        private void DrawInitial()
        {
            var arr = MathExtend.ListTo2DArr(inputData);

            var table = this.DrawTable(arr);

            addRowsFromSource(table, ref dataTable);
            dataTable.Visible = true;
        }
示例#2
0
        private bool NeedFiction()
        {
            bool res = false;

            for (int i = 0; i < freeCount; i++) // first column besides c0
            {
                if (_matrix[i, 0] < 0)
                {
                    res = true;
                    MathExtend.SumMatrixRows(ref _matrix, i, freeCount + 1);
                }
            }
            return(res);
        }
示例#3
0
        private void OptimizeMatrix() // get rid of all fractions
        {
            for (int i = 0; i < _dataMatrix.GetUpperBound(0); i++)
            {
                for (int j = 0; j < _dataMatrix.GetUpperBound(1); j++)
                {
                    double frac = Math.Abs(_dataMatrix[i, j] - Math.Truncate(_dataMatrix[i, j]));

                    if (frac > 0)
                    {
                        MathExtend.MultipleMatrixRow(ref _dataMatrix, 1 / frac, i);
                    }
                }
            }
        }
示例#4
0
        private void RowImprove(int target)
        {
            int col = SolvingColumn(target);
            int row = SolvingRow(col);

            double[,] tempMatrix = MathExtend.Copy(_tempMatrixes[_tempMatrixes.Count - 1]);
            MathExtend.Jordan(ref tempMatrix, row, col);

            _tempMatrixes.Add(CalcSum(tempMatrix));

            int temp = _plan[row];

            _plan[row]             = _allVariables[col - 1];
            _allVariables[col - 1] = _plan[row];

            //_tempMatrixes.Add(tempMatrix);
        }
示例#5
0
 public static double Nok(double a, double b)
 {
     return(Math.Abs(a * b) / MathExtend.Nod(a, b));
 }