예제 #1
0
파일: Program.cs 프로젝트: MichealRG/Simon
        static void Main(string[] args)
        {
            AssignWeight.WeightAssignment();
            PopulationGenerating.GeneratePopulation();
            SaveGenerationsToTextFile.SaveToFile();

            FitnessCalculation.HistroyOfFit[0] = 100000 - 2;
            FitnessCalculation.HistroyOfFit[1] = 100000 - 1;
            FitnessCalculation.HistroyOfFit[2] = 100000;
            FitnessCalculation.massiveFit      = 0;
            do
            {
                do
                {
                    FitnessCalculation.massiveFit = 0;
                    FitnessCalculation.CalculateFitness();
                    ShowPopulationOnScreen.ShowOnScreen();
                    Selection.Selecting();
                    AEXCrossing.AEX();
                    ChildrenFitnessCalculation.CalculateFitnessForChildren();
                    GenereteNewPopulation.GenerateNewPopulation();
                } while
                ((FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 1] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 2]) ||
                 (FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 2] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 3]) ||
                 (FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 3] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 4]));
                Mutation.Mutate();
            } while
            (FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 1] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 2] ||
             FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 2] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 3] ||
             FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 3] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 4] ||
             FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 4] < FitnessCalculation.HistroyOfFit[GenereteNewPopulation.t - 5]);
            FitnessCalculation.CalculateFitness();
            WritingResults.WriteResults();
        }
예제 #2
0
        static void Main(string[] args)
        {
            AEXCrossing            aex      = new AEXCrossing();
            FitnessCalculation     fc       = new FitnessCalculation();
            AssignWeight           aw       = new AssignWeight();
            PopulationGenerating   pg       = new PopulationGenerating();
            ShowPopulationOnScreen spos     = new ShowPopulationOnScreen();
            Selection                  s    = new Selection();
            GenereteNewPopulation      gnp  = new GenereteNewPopulation();
            SaveGenerationsToTextFile  save = new SaveGenerationsToTextFile();
            ChildrenFitnessCalculation cfc  = new ChildrenFitnessCalculation();
            Mutation       m  = new Mutation();
            WritingResults wr = new WritingResults();

            do
            {
                do
                {
                    aw.WeightAssignment();
                    pg.GeneratePopulation();
                    save.SaveToFile();
                    fc.CalculateFitness();
                    spos.ShowOnScreen();
                    s.Selecting();
                    //aex.AEX();
                    cfc.CalculateFitnessForChildren();
                    //gnp.GenerateNewPopulation();
                } while
                ((fc.HistroyOfFit[gnp.t - 1] < fc.HistroyOfFit[gnp.t - 2]) ||
                 (fc.HistroyOfFit[gnp.t - 2] < fc.HistroyOfFit[gnp.t - 3]) ||
                 (fc.HistroyOfFit[gnp.t - 3] < fc.HistroyOfFit[gnp.t - 4]));
                m.Mutate();
            } while
            (fc.HistroyOfFit[gnp.t - 1] < fc.HistroyOfFit[gnp.t - 2] ||
             fc.HistroyOfFit[gnp.t - 2] < fc.HistroyOfFit[gnp.t - 3] ||
             fc.HistroyOfFit[gnp.t - 3] < fc.HistroyOfFit[gnp.t - 4] ||
             fc.HistroyOfFit[gnp.t - 4] < fc.HistroyOfFit[gnp.t - 5]);
            fc.CalculateFitness();
            wr.WriteResults();
        }