private void Find_Max_Index(Simplex_Table _Table, List <int> _Residual)
        {
            int           Row_Count = _Table.Rows.Count - 1;
            List <double> Row       = _Table.Rows[Row_Count].Row_Values;
            int           count     = Row.Count;
            double        max       = -1;
            int           mx        = -1;

            for (int i = 0; i < count; i++)
            {
                if (max < Row[i])
                {
                    max = Row[i];
                    mx  = i;
                }
            }
            if (mx != -1)
            {
                for (int i = 0; i < count; i++)
                {
                    if (max == Row[i])
                    {
                        Value_Possibility VP = new Value_Possibility();
                        VP.Max_Index = i;
                        VP.Min_Selected_Indicators_Result = -1;
                        VP.Min_Selected_Indicator         = -1;
                        Data.Values.Add(VP);
                        Table_Possibility TP = new Table_Possibility();
                        TP.Table = Make_Simplex_Tabel_Copy(_Table);
                        TP.Residual.AddRange(_Residual);
                        Data.Tables.Add(TP);
                    }
                }
            }
        }
        private void Find_Min_Selected_Indicators_Result(Simplex_Table _Table, List <int> _Residual, int Max_Index)
        {
            double     min      = -1;
            int        mn       = -1;
            List <Row> Row_List = _Table.Rows;
            int        count    = Row_List.Count - 1;

            for (int i = 0; i < count; i++)
            {
                double value = _Table.Selected_Indicators_Result[i] / Row_List[i].Row_Values[Max_Index];
                if (value >= 0)
                {
                    min = value;
                    mn  = i;
                    i   = count;
                }
            }
            if (mn != -1)
            {
                for (int i = 0; i < count; i++)
                {
                    if (Row_List[i].Row_Values[Max_Index] >= 0)
                    {
                        double tikrinti = _Table.Selected_Indicators_Result[i] / Row_List[i].Row_Values[Max_Index];
                        if (tikrinti < min && tikrinti > 0)
                        {
                            min = tikrinti;
                            mn  = i;
                        }
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    if (Row_List[i].Row_Values[Max_Index] > 0)
                    {
                        double tikrinti = _Table.Selected_Indicators_Result[i] / Row_List[i].Row_Values[Max_Index];
                        if (tikrinti == min)
                        {
                            Value_Possibility newValue = new Value_Possibility();
                            newValue.Max_Index = Max_Index;
                            newValue.Min_Selected_Indicator         = i;
                            newValue.Min_Selected_Indicators_Result = min;
                            Data.Values.Add(newValue);
                            Table_Possibility TP = new Table_Possibility();
                            TP.Table = Make_Simplex_Tabel_Copy(_Table);
                            TP.Residual.AddRange(_Residual);
                            Data.Tables.Add(TP);
                        }
                    }
                }
            }
            else
            {
            }
        }
        private Boolean Simplex_Cycle_Step(ref Simplex_Table _Table, ref List <int> Residual, Value_Possibility _Value)
        {
            Boolean stop = false;

            if (Check_Symplex_Rules(_Table) == true)
            {
                Residual = new List <int> {
                };
                int Max_Index = _Value.Max_Index;
                int Min_Selected_Indicator         = _Value.Min_Selected_Indicator;
                int Min_Selected_Indicators_Result = Convert.ToInt32(Math.Floor(_Value.Min_Selected_Indicators_Result));
                if (Min_Selected_Indicator == -1 && Min_Selected_Indicators_Result == -1)
                {
                    return(false);
                }
                else
                {
                    _Table.Selected_Indicator[Min_Selected_Indicator] = Max_Index;
                    Transform_Main_Row(Min_Selected_Indicator, Max_Index, ref _Table);
                    Transform_Other_Rows(Min_Selected_Indicator, Max_Index, ref _Table);
                    Transform_Main_Collumn(Min_Selected_Indicator, Max_Index, ref _Table);
                    Recount_Selected_Indicators_Result(Min_Selected_Indicator, Max_Index, Min_Selected_Indicators_Result, ref _Table, ref Residual);
                    stop = Test_Simplex_Answer(_Table, Residual);
                    if (stop == false)
                    {
                        return(false);
                    }
                    return(true);
                }
            }
            return(false);
        }
 private Boolean Simplex_Cycle_Step(ref Simplex_Table _Table, ref List<int> Residual, Value_Possibility _Value)
 {
     Boolean stop = false;
     if (Check_Symplex_Rules(_Table) == true)
     {
         Residual = new List<int> { };
         int Max_Index = _Value.Max_Index;
         int Min_Selected_Indicator = _Value.Min_Selected_Indicator;
         int Min_Selected_Indicators_Result = Convert.ToInt32(Math.Floor(_Value.Min_Selected_Indicators_Result));
         if (Min_Selected_Indicator == -1 && Min_Selected_Indicators_Result == -1)
         {
             return false;
         }
         else
         {
             _Table.Selected_Indicator[Min_Selected_Indicator] = Max_Index;
             Transform_Main_Row(Min_Selected_Indicator, Max_Index, ref _Table);
             Transform_Other_Rows(Min_Selected_Indicator, Max_Index, ref _Table);
             Transform_Main_Collumn(Min_Selected_Indicator, Max_Index, ref _Table);
             Recount_Selected_Indicators_Result(Min_Selected_Indicator, Max_Index, Min_Selected_Indicators_Result, ref _Table, ref Residual);
             stop = Test_Simplex_Answer(_Table, Residual);
             if (stop == false)
             {
                 return false;
             }
             return true;
         }
     }
     return false;
 }
        private void Find_Min_Selected_Indicators_Result(Simplex_Table _Table, List<int> _Residual, int Max_Index)
        {
            double min = -1;
            int mn = -1;
            List<Row> Row_List = _Table.Rows;
            int count = Row_List.Count - 1;
            for (int i = 0; i < count; i++)
            {
                double value = _Table.Selected_Indicators_Result[i] / Row_List[i].Row_Values[Max_Index];
                if (value >= 0)
                {
                    min = value;
                    mn = i;
                    i = count;
                }
            }
            if (mn != -1)
            {
                for (int i = 0; i < count; i++)
                {
                    if (Row_List[i].Row_Values[Max_Index] >= 0)
                    {
                        double tikrinti = _Table.Selected_Indicators_Result[i] / Row_List[i].Row_Values[Max_Index];
                        if (tikrinti < min && tikrinti > 0)
                        {
                            min = tikrinti;
                            mn = i;
                        }
                    }
                }
                for (int i = 0; i < count; i++)
                {
                    if (Row_List[i].Row_Values[Max_Index] > 0)
                    {
                        double tikrinti = _Table.Selected_Indicators_Result[i] / Row_List[i].Row_Values[Max_Index];
                        if (tikrinti == min)
                        {
                            Value_Possibility newValue = new Value_Possibility();
                            newValue.Max_Index = Max_Index;
                            newValue.Min_Selected_Indicator = i;
                            newValue.Min_Selected_Indicators_Result = min;
                            Data.Values.Add(newValue);
                            Table_Possibility TP = new Table_Possibility();
                            TP.Table = Make_Simplex_Tabel_Copy(_Table);
                            TP.Residual.AddRange(_Residual);
                            Data.Tables.Add(TP);
                        }
                    }
                }
            }
            else
            {

            }
        }
 private void Find_Max_Index(Simplex_Table _Table, List<int> _Residual)
 {
     int Row_Count = _Table.Rows.Count - 1;
     List<double> Row = _Table.Rows[Row_Count].Row_Values;
     int count = Row.Count;
     double max = -1;
     int mx = -1;
     for (int i = 0; i < count; i++)
     {
         if (max < Row[i])
         {
             max = Row[i];
             mx = i;
         }
     }
     if (mx != -1)
     {
         for (int i = 0; i < count; i++)
         {
             if (max == Row[i])
             {
                 Value_Possibility VP = new Value_Possibility();
                 VP.Max_Index = i;
                 VP.Min_Selected_Indicators_Result = -1;
                 VP.Min_Selected_Indicator = -1;
                 Data.Values.Add(VP);
                 Table_Possibility TP = new Table_Possibility();
                 TP.Table = Make_Simplex_Tabel_Copy(_Table);
                 TP.Residual.AddRange(_Residual);
                 Data.Tables.Add(TP);
             }
         }
     }
 }