コード例 #1
0
        public FormGAOptions(FRF[] vClose_ref, VelocityResponse vR, FormMain.FittingOptimization fittingOPT, List <FormMain.InitialFrequencyPoints> initialValues)
        {
            InitializeComponent();
            VClose_ref = vClose_ref;
            VR         = vR;
            FittingOPT = fittingOPT;
            FormMain.DrawLine(VClose_ref, 0, chart_mag, chart_phs);

            PlottingGAData();

            textBoxFreq_1.Text    = initialValues[0].ResonantFreqPeak.ToString();
            textBoxMag_1.Text     = initialValues[0].ResonantMagPeak.ToString();
            textBoxFreqMax_1.Text = initialValues[0].FrequencyRage.MaxValue.ToString();
            textBoxFreqMin_1.Text = initialValues[0].FrequencyRage.MinValue.ToString();

            textBoxFreq_2.Text    = initialValues[1].ResonantFreqPeak.ToString();
            textBoxMag_2.Text     = initialValues[1].ResonantMagPeak.ToString();
            textBoxFreqMax_2.Text = initialValues[1].FrequencyRage.MaxValue.ToString();
            textBoxFreqMin_2.Text = initialValues[1].FrequencyRage.MinValue.ToString();

            textBoxFreq_3.Text    = initialValues[2].ResonantFreqPeak.ToString();
            textBoxMag_3.Text     = initialValues[2].ResonantMagPeak.ToString();
            textBoxFreqMax_3.Text = initialValues[2].FrequencyRage.MaxValue.ToString();
            textBoxFreqMin_3.Text = initialValues[2].FrequencyRage.MinValue.ToString();

            textBoxPCross.Text    = FittingOPT.GA[0].GA_Settings.PCrossover.ToString();
            textBoxPMutation.Text = FittingOPT.GA[0].GA_Settings.PMutation.ToString();
            textBoxPop.Text       = FittingOPT.GA[0].GA_Settings.PopulationSize.ToString();
            textBoxGen.Text       = FittingOPT.GA[0].GA_Settings.Generations.ToString();
        }
コード例 #2
0
        private void GeneticAlgorithmOptimization(List <FormMain.InitialFrequencyPoints> ResonantPeak)
        {
            List <Mode> VLoopModes = new List <Mode>();

            FormMain.CreateModes(VLoopModes);

            GeneticAlgorithm.Range Mass_range = new GeneticAlgorithm.Range {
                MinValue = FormMain.TryToDouble(textBoxMassMin.Text), MaxValue = FormMain.TryToDouble(textBoxMassMax.Text)
            };
            GeneticAlgorithm.Range Zeta_range = new GeneticAlgorithm.Range {
                MinValue = FormMain.TryToDouble(textBoxZetaMin.Text), MaxValue = FormMain.TryToDouble(textBoxZetaMax.Text)
            };

            List <GeneticAlgorithm.Range> FrequencyRange = new List <GeneticAlgorithm.Range>();

            for (int i = 0; i < ResonantPeak.Count; i++)
            {
                FrequencyRange.Add(ResonantPeak[i].FrequencyRage);
            }

            FittingOPT = new FormMain.FittingOptimization(Mass_range, Zeta_range, FrequencyRange);

            FittingOPT.SetOptimizationParameters((int)FormMain.TryToDouble(textBoxPop.Text), FormMain.TryToDouble(textBoxPCross.Text), FormMain.TryToDouble(textBoxPMutation.Text), (int)FormMain.TryToDouble(textBoxGen.Text), 500);

            FittingOPT.SetReference(VClose_ref, VR, VLoopModes);

            VLoopModes = new List <Mode>();
            VLoopModes = FittingOPT.Solve();

            //Create Structure Nature Modes Object

            VR.VLoopModes = VLoopModes;

            //Evaluation
            FRF[] Close = VR.SolveCloseLoopResponse();
            //FRF[] Open = VR.SolveOpenLoopResponse();

            // draw simulated FRF in chart
            FormMain.DrawLine(Close, 1, chart_mag, chart_phs);
        }