예제 #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            this.button4.Enabled = false;

            //Data d = new Data();
            //AlgorithmSteadyState a = new AlgorithmSteadyState();
            //a.Execute(d.GetFlightData());

            AlgorithmTreeStyle a = new AlgorithmTreeStyle();

            a.Execute(data.OrderBy(rw => rw.intScheduledTime).ToList());
            this.button4.Enabled = true;
            MessageBox.Show("Evaluation: " + a.getBestQuality());
        }
예제 #2
0
        public void ExecuteExperiment()
        {
            int Min = int.MaxValue;
            int Max = int.MinValue;

            for (int InstanceIndex = 0; InstanceIndex < NumberOfInstances; InstanceIndex++)
            {
                //if (InstanceIndex != 10)
                //    continue;
                String InstanceName = "FPT" + this.rregulateInstanceIndex(InstanceIndex + 1, mInstanceSet);
                InstanceNames[InstanceIndex] = InstanceName;
                String        FullPath = "Instances\\" + mInstanceSet + "\\" + InstanceName + ".txt";
                List <Flight> data     = this.getInstanceData(FullPath);
                int           currentInstancePeriodLength = data[data.Count - 1].intScheduledTime - data[0].intScheduledTime;
                if (currentInstancePeriodLength < Min)
                {
                    Min = currentInstancePeriodLength;
                }
                if (currentInstancePeriodLength > Max)
                {
                    Max = currentInstancePeriodLength;
                }

                for (int ExecutionIndex = 0; ExecutionIndex < NumberOfExecutions; ExecutionIndex++)
                {
                    BasicFunctions.sw.Restart();
                    if (mMethodName == "Generational")
                    {
                        AlgorithmGenerational ag = new AlgorithmGenerational();
                        ag.Execute(data.OrderBy(rw => rw.intScheduledTime).ToList());
                        Evaluation[InstanceIndex, ExecutionIndex] = ag.getBestQuality();
                    }
                    else if (mMethodName == "Elitism")
                    {
                        AlgorithmElitism ag = new AlgorithmElitism();
                        ag.Execute(data.OrderBy(rw => rw.intScheduledTime).ToList());
                        Evaluation[InstanceIndex, ExecutionIndex] = ag.getBestQuality();
                    }
                    else if (mMethodName == "Steady state")
                    {
                        AlgorithmSteadyState ag = new AlgorithmSteadyState();
                        ag.Execute(data.OrderBy(rw => rw.intScheduledTime).ToList());
                        Evaluation[InstanceIndex, ExecutionIndex] = ag.getBestQuality();
                    }
                    else if (mMethodName == "Tree style")
                    {
                        AlgorithmTreeStyle ag = new AlgorithmTreeStyle();
                        ag.Execute(data.OrderBy(rw => rw.intScheduledTime).ToList());
                        Evaluation[InstanceIndex, ExecutionIndex] = ag.getBestQuality();
                    }

                    BasicFunctions.sw.Stop();
                    Time[InstanceIndex, ExecutionIndex] = (int)BasicFunctions.calculationTime;
                    //Time[InstanceIndex, ExecutionIndex] = (int)sw.Elapsed.TotalMilliseconds;
                }
            }


            this.CalculateCumulatives(Evaluation, ref CumulativeEvaluation);
            this.CalculateCumulatives(Time, ref CumulativeTime);

            Console.WriteLine("Maximal period of schedule: " + Max);
            Console.WriteLine("Minimal period of schedule: " + Min);
        }