public void set_data_grid_propsed_DGV(output_result res)
        {

            bearing_cost_value_2.Text = res.All_bears_cost.ToString();

            delay_time_cost_value_2.Text = res.All_delay_time_cost.ToString();

            down_time_cost_value_2.Text = res.All_downtime_cost.ToString();

            repair_person_cost_value_2.Text = res.All_repaire_person_cost.ToString();

            total_cost_2.Text = res.total_cost.ToString();

        }
        //calculation of proposed system
        public static void proposed_system()
        {
            min_cost_proposed = 1000000;
            max_cost_proposed = -1;
            all_costs = new double[num_trial];
            output_result temp = new output_result();
            int cnt;
           // intialize_random();

            for (int i = 0; i < num_trial; ++i)
            {
                cnt = 0;
                delay = 0;

                while (true)
                {
                    if (cnt > 0 && Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt - 1].Cells[5].Value) >= hour_num)
                        break;

                    obj[i].DGV_Proposed.Rows.Add();
                    obj[i].DGV_Proposed.Rows[cnt].Cells[0].Value = cnt + 1;


                    if (Beer_Life[i,cnt] == null || Beer_Life[i,cnt].beer_one == null)
                        obj[i].DGV_Proposed.Rows[cnt].Cells[1].Value = Distribution.get_life_hour(generate_random_value_two_digit(), beerProb);

                    else
                        obj[i].DGV_Proposed.Rows[cnt].Cells[1].Value = Beer_Life[i,cnt].beer_one;



                    if (Beer_Life[i,cnt] == null || Beer_Life[i,cnt].beer_two == null)
                        obj[i].DGV_Proposed.Rows[cnt].Cells[2].Value = Distribution.get_life_hour(generate_random_value_two_digit(), beerProb);

                    else
                        obj[i].DGV_Proposed.Rows[cnt].Cells[2].Value = Beer_Life[i,cnt].beer_two;




                    if (Beer_Life[i,cnt] == null || Beer_Life[i,cnt].beer_three == null)
                        obj[i].DGV_Proposed.Rows[cnt].Cells[3].Value = Distribution.get_life_hour(generate_random_value_two_digit(), beerProb);

                    else
                        obj[i].DGV_Proposed.Rows[cnt].Cells[3].Value = Beer_Life[i,cnt].beer_three;




                    obj[i].DGV_Proposed.Rows[cnt].Cells[4].Value = Math.Min(Math.Min(Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt].Cells[1].Value), Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt].Cells[2].Value)), Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt].Cells[3].Value));

                    if (cnt == 0)
                        obj[i].DGV_Proposed.Rows[cnt].Cells[5].Value = obj[i].DGV_Proposed.Rows[cnt].Cells[4].Value;
                    else
                        obj[i].DGV_Proposed.Rows[cnt].Cells[5].Value = Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt].Cells[4].Value) + Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt - 1].Cells[5].Value);

                    obj[i].DGV_Proposed.Rows[cnt].Cells[6].Value = generate_random_value_one_digit();

                    obj[i].DGV_Proposed.Rows[cnt].Cells[7].Value = Distribution.get_delay_minute(Convert.ToUInt32(obj[i].DGV_Proposed.Rows[cnt].Cells[6].Value), delayProb);
                    delay += Convert.ToInt32(obj[i].DGV_Proposed.Rows[cnt].Cells[7].Value);

                    ++cnt;
                }
                temp.All_bears_cost = cnt * 3 * bear_propreties.Bear_cost;
                temp.All_delay_time_cost = (delay) * bear_propreties.Downtime_cost;
                temp.All_downtime_cost = bear_propreties.Repaire_time_three * bear_propreties.Downtime_cost * cnt;
                temp.All_repaire_person_cost = cnt * bear_propreties.Repaire_time_three * (bear_propreties.Repaire_Person_cost) / 60;
                temp.total_cost = temp.All_bears_cost + temp.All_delay_time_cost + temp.All_downtime_cost + temp.All_repaire_person_cost;

                all_costs[i] = temp.total_cost;
                min_cost_proposed = Math.Min(all_costs[i], min_cost_proposed);
                max_cost_proposed = Math.Max(all_costs[i], max_cost_proposed);

                obj[i].set_data_grid_propsed_DGV(temp);
            }



            double range = max_cost_proposed - min_cost_proposed;
            frequency_proposed = new double[num_ranges];
            ranges_value = new double[num_ranges];

            calculate_frequency(range, frequency_proposed, min_cost_proposed);
           

            obj[0].Show();
        }
        //calculation of current system
        public static void current_system()
        {
            min_cost_current = 1000000;
            max_cost_current = -1;

            all_costs= new double[num_trial];

            int sze =  hour_num / int.Parse(beerProb[0].realvalue);
            if (sze == 0)
                sze = 1000;
            Beer_Life = new Life_Beer_Method_one[num_trial , sze];

            obj = new System_Output[num_trial];

            output_result temp = new output_result();
            int cnt ,num_used_bear;
            bool one, two, three;
            intialize_random();
            for (int i = 0; i < num_trial; ++i)
            {
                 cnt = 0;
                one = two = three = false;
                num_used_bear = bear_one_delay = bear_two_delay = bear_three_delay = 0;

                obj[i] = new System_Output();

                while (true)
                {
                    Beer_Life[i,cnt] = new Life_Beer_Method_one();
                    

                    obj[i].DGV_Current.Rows.Add();
                    obj[i].DGV_Current.Rows[cnt].Cells[0].Value = cnt + 1;

                    if (one == false)
                    {
                        ++num_used_bear;
                        one = three_beer(i, cnt, 1, 2, 3, 4, 5);
                    }
                    if (two == false)
                    {
                        ++num_used_bear;
                        two = three_beer(i, cnt, 6, 7, 8, 9, 10);
                    }
                    if (three == false)
                    {
                        ++num_used_bear;
                        three = three_beer(i, cnt, 11, 12, 13, 14, 15);
                    }
                    if (one == true && two == true && three == true)
                        break;
                    ++cnt;
                }
                num_used_bear -= 3;

                temp.All_bears_cost = num_used_bear * bear_propreties.Bear_cost;
                temp.All_delay_time_cost = (bear_one_delay + bear_two_delay + bear_three_delay) * bear_propreties.Downtime_cost;
                temp.All_downtime_cost = bear_propreties.Repaire_time_one * bear_propreties.Downtime_cost * num_used_bear;
                temp.All_repaire_person_cost = num_used_bear * bear_propreties.Repaire_time_one * (bear_propreties.Repaire_Person_cost) / 60;
                temp.total_cost = temp.All_bears_cost + temp.All_delay_time_cost + temp.All_downtime_cost + temp.All_repaire_person_cost;
                all_costs[i] = temp.total_cost;
                min_cost_current = Math.Min(all_costs[i], min_cost_current);
                max_cost_current = Math.Max(all_costs[i], max_cost_current);
                obj[i].set_data_grid_current_DGV(temp);
            }




            double range = max_cost_current - min_cost_current;
            frequency_current = new double[num_ranges];
            ranges_value = new double[num_ranges];

            calculate_frequency(range, frequency_current, min_cost_current);

        }