public GH_ParameterHandler(NSGAII_GHComponent _GHComponent)
        {
            gh    = _GHComponent;
            ghDoc = gh.OnPingDocument();

            InitializeGeneInputs();

            //ghDoc.SolutionEnd += new GH_Document.SolutionEndEventHandler(OnSolutionEnd);
            //waitHandle = new AutoResetEvent(false);
        }
Exemple #2
0
        // Constructor
        public NSGAII_Editor(NSGAII_GHComponent _GHComponent)
        {
            GH_Component = _GHComponent;
            visualizer   = new NSGAII_Visualizer(this, GH_Component);

            InitializeComponent();     // <- Windows Forms Window
            InitializeOptimization();
            InitializeFitnessDataGrid();

            TimeChecked        = TimeCheckBox.Checked;
            GenerationsChecked = GenerationsCheckBox.Checked;


            // Initialize list of objectives (default => Minimize)
            NSGAII_Algorithm.ObjectiveList = new List <Objectives>();

            for (int i = 0; i < GH_Component.Params.Input[1].SourceCount; i++)
            {
                NSGAII_Algorithm.ObjectiveList.Add(Objectives.Minimize);
            }


            // Initialize list of Fitness Names
            visualizer.fitnessNames = new List <string>();

            for (int i = 0; i < GH_Component.Params.Input[1].SourceCount; i++)
            {
                visualizer.fitnessNames.Add(FitnessDataGrid.Rows[i].Cells[0].Value.ToString());
            }



            // Asynchronous Run Optimization
            backgroundWorker = new BackgroundWorker()
            {
                WorkerReportsProgress      = true,
                WorkerSupportsCancellation = true
            };
            backgroundWorker.DoWork             += NSGAII_Algorithm.NSGAII;
            backgroundWorker.ProgressChanged    += OptimizationInProgress;
            backgroundWorker.RunWorkerCompleted += OptimizationComplete;
        }