示例#1
0
        /// <summary>
        /// Mostra o fitness e desenha o quadrado resposta (cromossomo)
        /// </summary>
        /// <param name="circuitChromo"></param>
        /// <param name="lFitness"></param>
        private void ShowChromosome(CircuitoChromosome circuitChromo, Label lFitness)
        {
            if (circuitChromo == null) return;
            lblGeneration.Text = (_ga.Generation + 1).ToString();
            lFitness.Text = circuitChromo.GetFitness().ToString();
            lblFitness4.Text = circuitChromo.GetFitness().ToString();
            //DrawTable(eqc.Valores);
            txtGeneAgv.Text = String.Empty;
            foreach (int i in circuitChromo.Cgp.Genotype)
                txtGeneAgv.Text = txtGeneAgv.Text + i + ";";
            //Remove o ultimo ';'
            txtGeneAgv.Text = txtGeneAgv.Text.Remove(txtGeneAgv.Text.Length - 1);

            //DataRow drResultado = dtResultados.NewRow();
            //drResultado["Bestfitness"] = -1;
            //drResultado["Averagefitness"] = (int)circuitChromo.Fitness;
            //drResultado["geracao"] = Convert.ToInt32(lblGeneration.Text.Trim());
            //dtResultados.Rows.Add(drResultado);
            averagefitness += (int)circuitChromo.Fitness;
        }