Exemplo n.º 1
0
 static Qmatrix()
 {
     //Default limit
     e_initial     = InitialSettings.e();
     episode_limit = InitialSettings.episode_limit();
     step_limit    = InitialSettings.step_limit();
 }
Exemplo n.º 2
0
        private void comboboxDelayms_Leave(object sender, EventArgs e)
        {
            bool success = Int32.TryParse(comboboxDelayms.Text, out int result);

            if (!success || result < 0)
            {
                comboboxDelayms.Text = InitialSettings.ms_delay().ToString();
            }
            else
            {
                comboboxDelayms.Text = result.ToString();
            }
        }
Exemplo n.º 3
0
        public Qmatrix()
        {
            //This is our q-matrix
            matrix_data   = new Dictionary <PerceptionState, ValueSet>();
            did_we_update = false;

            e_current = InitialSettings.e(); //Epsilon; do we explore or exploit. Random factor for taking a best move or random move.
            y_current = InitialSettings.y(); //Gamma; our discounted rate.
            n_current = InitialSettings.n(); //The learning rate
            y         = InitialSettings.y();

            step_limit    = InitialSettings.step_limit(); //limits
            episode_limit = InitialSettings.episode_limit();
        }
Exemplo n.º 4
0
 private void comboboxDelayms_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 13)
     {
         bool success = Int32.TryParse(comboboxDelayms.Text, out int result);
         if (!success || result < InitialSettings.ms_delay())
         {
             comboboxDelayms.Text = InitialSettings.ms_delay().ToString();
         }
         else
         {
             comboboxDelayms.Text = result.ToString();
         }
     }
 }
Exemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            AlgorithmState.SetDefaultConfiguration();


            //Second entry point of the program.
            //When the form loads, we'll create some pictureboxes, that will function as the robot world grid.


            PictureBox    picturebox_in_progress; //Temporary picturebox
            PictureSquare square_to_build;        //This is object inherits from boardSquare, but has a picture element.

            //Create pictureboxes and pass them to our board
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    //Fill in the column with rows
                    picturebox_in_progress          = new PictureBox();
                    square_to_build                 = new PictureSquare();
                    picturebox_in_progress.Name     = i.ToString() + "-" + j.ToString(); //Each name is the coordinate
                    picturebox_in_progress.Location =
                        new Point(InitialSettings.x_offset() + (i * InitialSettings.edge_length()),
                                  InitialSettings.y_offset() + (j * InitialSettings.edge_length()));
                    picturebox_in_progress.Size     = new Size(InitialSettings.edge_length(), InitialSettings.edge_length());
                    picturebox_in_progress.SizeMode = PictureBoxSizeMode.StretchImage;
                    picturebox_in_progress.BackgroundImageLayout = ImageLayout.Stretch;
                    Controls.Add(picturebox_in_progress);
                    square_to_build.pictureData = picturebox_in_progress;
                    FormsHandler.Add(i, 9 - j, square_to_build); //9-j to handle the board layout, for some reason!
                }
            }

            //Called from the restart button, but works here on initial launch.
            //This triggers the constructor for algorithm manager, as well

            textboxStatus.Text = "Program launched.";

            FormsHandler.DisplayState(); //First time we display the board.
        }
Exemplo n.º 6
0
        static public PictureBoard picture_board;  //Stored seperately from the algorithm state because this board will store PictureSquares

        static FormsHandler()
        {
            picture_board = new PictureBoard();
            loaded_state  = new AlgorithmState();

            lock_index_change_events = false;
            halted = false;
            //Pass textboxes to the board, so it can manage them.

            link_handler_to_form();

            //Initialize dropdown boxes
            control_progress_steps.SelectedIndex = 0;
            control_progress_episodes.Text       = "0";;
            control_progress_delay.Text          = InitialSettings.ms_delay().ToString();

            foreach (var i in list_qmatrix_comboboxes)
            {
                i.Value.SelectedIndex = -1;
            }

            DisplayInitialSettings();
        }