public void intertime_dist_set(int t, decimal prob, int cust, int rows, int listOfTime)
        {
            InterarrivalDistribution.Add(new TimeDistribution());
            InterarrivalDistribution[listOfTime].Time        = t;
            InterarrivalDistribution[listOfTime].Probability = prob;
            IntComProb += prob;
            InterarrivalDistribution[listOfTime].CummProbability = IntComProb;

            InterarrivalDistribution[listOfTime].MinRange = Imin + 1;
            InterarrivalDistribution[listOfTime].MaxRange = Convert.ToInt32(IntComProb * 100);
            Imin = InterarrivalDistribution[listOfTime].MaxRange;
        }
示例#2
0
        public void ReadInput(string filepath)
        {
            string       str;
            FileStream   fs = new FileStream(filepath, FileMode.Open);
            StreamReader SR = new StreamReader(fs);

            //    char s = (char)SR.Read();
            while (SR.Peek() != -1)
            {
                str = SR.ReadLine();
                if (str == "NumberOfServers")
                {
                    NumberOfServers = int.Parse(SR.ReadLine());
                    SR.ReadLine();
                    continue;
                }
                else if (str == "StoppingNumber")
                {
                    StoppingNumber = int.Parse(SR.ReadLine());
                    SR.ReadLine();
                    continue;
                }
                else if (str == "StoppingCriteria")
                {
                    StoppingCriteria = (Enums.StoppingCriteria)(int.Parse(SR.ReadLine()));
                    SR.ReadLine();
                    continue;
                }
                else if (str == "SelectionMethod")
                {
                    SelectionMethod = (Enums.SelectionMethod)(int.Parse(SR.ReadLine()));
                    SR.ReadLine();
                    continue;
                }
                else if (str == "InterarrivalDistribution")
                {
                    str = SR.ReadLine();
                    while (str != "")
                    {
                        string[]         substrings = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        TimeDistribution TD         = new TimeDistribution();
                        TD.Time        = int.Parse(substrings[0]);
                        TD.Probability = decimal.Parse(substrings[1]);
                        str            = SR.ReadLine();
                        InterarrivalDistribution.Add(TD);
                    }
                    generate_cumulative_range(InterarrivalDistribution);
                    continue;
                }
                else
                {
                    for (int i = 0; i < NumberOfServers; i++)
                    {
                        Servers.Add(new Server());
                        Servers[i].ID = i + 1;
                        str           = SR.ReadLine();
                        while (str != "" && str != null)
                        {
                            string[]         substrings = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            TimeDistribution TD         = new TimeDistribution();
                            TD.Time        = int.Parse(substrings[0]);
                            TD.Probability = decimal.Parse(substrings[1]);
                            str            = SR.ReadLine();
                            Servers[i].TimeDistribution.Add(TD);
                        }
                        str = SR.ReadLine();
                        continue;
                    }
                }
            }
            SR.Close();
        }