Пример #1
0
        // Restarting the AGVs simulation
        private void btnReset_Click(object sender, System.EventArgs e)
        {
            chkFalhaSensorFrontal0.Checked = false;
            chkFalhaSensorFrontal1.Checked = false;
            chkFalhaSensorFrontal2.Checked = false;
            chkFalhaSensorFrontal3.Checked = false;
            chkFalhaSensorFrontal4.Checked = false;
            chkFalhaSensorFrontal5.Checked = false;

            Angle = 0;

            sensors = new bool[8];
            sensors[0] = false;
            sensors[1] = false;
            sensors[2] = false;
            sensors[3] = false;
            sensors[4] = false;
            sensors[5] = false;
            sensors[6] = false;
            sensors[7] = false;
            _traz = false;
            //_ga = new EA(3, 2, sensors);
            _ga = new EA(3, 2, sensors);
            _ga.K = Convert.ToInt32(txtk.Text);

            dtResultados = new DataTable();
            dtResultados.Columns.Add("geracao", typeof(int));
            dtResultados.Columns.Add("Bestfitness", typeof(int));
            dtResultados.Columns.Add("Averagefitness", typeof(int));

            FirstInference = true;
            pbRobot.Top = pbTerrain.Bottom - 100;
            pbRobot.Left = pbTerrain.Left + 100;
            InitialPos = pbRobot.Location;
            RunLabel = btnRun.Text;

            btnRun.Enabled = true;
            ctControleParent = 0;
            ctControleClones = 0;
            ctControleParent = 0;
            ctControleClones = 0;
            //ctPaisDecrescente = _ga.PopulationSize;
            ctPaisDecrescente = _ga.PopulationSize;

            lblFitness4.Text = "0";
            lblGeneration.Text = "1";

            _bCiclo = false;
            pbLimiar0.Visible = false;
            pbLimiar1.Visible = false;
            pbLimiar2.Visible = false;
            pbLimiar3.Visible = false;
            pbLimiar4.Visible = false;
            pbLimiar5.Visible = false;

            Angle = 0;
            pbTerrain.Image = new Bitmap(InitialMap);
            OriginalMap = new Bitmap(InitialMap);
            FirstInference = true;
            pbRobot.Location = InitialPos;
            txtFront0.Text = "0";
            txtFront1.Text = "0";
            txtFront2.Text = "0";
            txtFront3.Text = "0";
            txtFront4.Text = "0";
            txtFront5.Text = "0";

            txtAngle.Text = "0,00";
        }
Пример #2
0
        public MainForm()
        {
            InitializeComponent();
            Angle = 0;
            OriginalMap = new Bitmap(pbTerrain.Image);
            InitialMap = new Bitmap(pbTerrain.Image);
            sensors = new bool[8];
            sensors[0] = false;
            sensors[1] = false;
            sensors[2] = false;
            sensors[3] = false;
            sensors[4] = false;
            sensors[5] = false;
            sensors[6] = false;
            sensors[7] = false;
            _traz = false;

            //_ga = new EA(3, 2, sensors);
            _ga = new EA(3, 2, sensors);
            //ctPaisDecrescente = _ga.PopulationSize;
            ctPaisDecrescente = _ga.PopulationSize;
            _ga.K = Convert.ToInt32(txtk.Text);
            dtResultados = new DataTable();
            dtResultados.Columns.Add("geracao", typeof(int));
            dtResultados.Columns.Add("Bestfitness", typeof(int));
            dtResultados.Columns.Add("Averagefitness", typeof(int));

            FirstInference = true;
            pbRobot.Top = pbTerrain.Bottom - 100;
            pbRobot.Left = pbTerrain.Left + 100;
            InitialPos = pbRobot.Location;
            RunLabel = btnRun.Text;
        }