コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (numNumberOfChromosomes.Value < 2)
            {
                numNumberOfChromosomes.Value = 2;
            }

            if (numTrackBest.Value >= numNumberOfChromosomes.Value)
            {
                numTrackBest.Value = numNumberOfChromosomes.Value - 1;
            }

            if (numReplaceByGeneration.Value > numNumberOfChromosomes.Value - numTrackBest.Value)
            {
                numReplaceByGeneration.Value = numNumberOfChromosomes.Value - numTrackBest.Value;
            }

            Algorithm.Schedule prototype = new Algorithm.Schedule(
                (int)numNumberOfCrossoverPoints.Value,
                (int)numMutationSize.Value,
                (int)numCrossoverProbability.Value,
                (int)numMutationProbability.Value);

            Algorithm.Schedule.ScheduleObserver sso = new Algorithm.Schedule.ScheduleObserver();
            sso.SetWindow(ResultForm.create_GridView);
            ResultForm.AA = new MakeClassSchedule.Algorithm.Algorithm(
                (int)numNumberOfChromosomes.Value,
                (int)numReplaceByGeneration.Value,
                (int)numTrackBest.Value,
                prototype, sso);

            this.Dispose();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (numNumberOfChromosomes.Value < 2) numNumberOfChromosomes.Value = 2;

            if (numTrackBest.Value >= numNumberOfChromosomes.Value)
                numTrackBest.Value = numNumberOfChromosomes.Value - 1;

            if (numReplaceByGeneration.Value > numNumberOfChromosomes.Value - numTrackBest.Value)
                numReplaceByGeneration.Value = numNumberOfChromosomes.Value - numTrackBest.Value;

            Algorithm.Schedule prototype = new Algorithm.Schedule(
                (int)numNumberOfCrossoverPoints.Value,
                (int)numMutationSize.Value,
                (int)numCrossoverProbability.Value,
                (int)numMutationProbability.Value);

            Algorithm.Schedule.ScheduleObserver sso = new Algorithm.Schedule.ScheduleObserver();
            sso.SetWindow(ResultForm.create_GridView);
            ResultForm.AA = new MakeClassSchedule.Algorithm.Algorithm(
                (int)numNumberOfChromosomes.Value,
                (int)numReplaceByGeneration.Value,
                (int)numTrackBest.Value,
                prototype, sso);

            this.Dispose();
        }