Beispiel #1
0
 static BoardSquareWalls()
 {
     top_wall_data          = new BoardSquareWalls(Move.up());
     bottom_wall_data       = new BoardSquareWalls(Move.down());
     left_wall_data         = new BoardSquareWalls(Move.left());
     right_wall_data        = new BoardSquareWalls(Move.right());
     top_left_wall_data     = new BoardSquareWalls(Move.left(), Move.up());
     top_right_wall_data    = new BoardSquareWalls(Move.right(), Move.up());
     bottom_left_wall_data  = new BoardSquareWalls(Move.left(), Move.down());
     bottom_right_wall_data = new BoardSquareWalls(Move.right(), Move.down());
     empty_wall_data        = new BoardSquareWalls();
 }
        static PerceptionState()
        {
            //Create all 243 possible configurations

            list_of_states = new Dictionary <PerceptionState, PerceptionState>();

            PerceptionState to_build;

            foreach (var i in Percept.get_list())
            {
                foreach (var j in Percept.get_list())
                {
                    foreach (var k in Percept.get_list())
                    {
                        foreach (var l in Percept.get_list())
                        {
                            foreach (var m in Percept.get_list())
                            {
                                to_build = new PerceptionState();
                                to_build.perception_data[Move.left()]  = i;
                                to_build.perception_data[Move.right()] = j;
                                to_build.perception_data[Move.down()]  = k;
                                to_build.perception_data[Move.up()]    = l;
                                to_build.perception_data[Move.grab()]  = m;
                                to_build.set_id(list_of_states.Count);
                                to_build.set_name();

                                list_of_states.Add(to_build, to_build);
                                //list_of_states[to_build] = to_build;
                                //Add the perception state to our dictionary at a location reachable if we can build a similar dictionary.
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        static public void link_handler_to_form()
        {
            form1_control             = Application.OpenForms["Form1"];
            groupbox_initial_settings = form1_control.Controls["groupboxInitialsettings"] as GroupBox;
            groupbox_rewards          = groupbox_initial_settings.Controls["groupboxRewards"] as GroupBox;;
            groupbox_qmatrix          = form1_control.Controls["groupboxQmatrix"] as GroupBox;;
            groupbox_matrix_select    = groupbox_qmatrix.Controls["groupboxQmatrixselect"] as GroupBox;;
            groupbox_qmatrix_values   = form1_control.Controls["groupboxQmatrix"].Controls["groupboxQmatrixview"] as GroupBox;;
            groupbox_session_progress = form1_control.Controls["groupboxSessionprogress"] as GroupBox;;
            groupbox_can_data         = groupbox_session_progress.Controls["groupboxCans"] as GroupBox;;
            groupbox_reward_data      = groupbox_session_progress.Controls["groupboxRewarddata"] as GroupBox;;
            groupbox_current_position = groupbox_session_progress.Controls["groupboxCurrentposition"] as GroupBox;;

            //Initial settings
            number_of_episodes = groupbox_initial_settings.Controls["textboxInitialNumberofepisodes"] as TextBox;
            number_of_steps    = groupbox_initial_settings.Controls["textboxInitialNumberofsteps"] as TextBox;
            n_initial          = groupbox_initial_settings.Controls["textboxInitialNinitial"] as TextBox;
            y_initial          = groupbox_initial_settings.Controls["textboxInitialY"] as TextBox;
            e_initial          = groupbox_initial_settings.Controls["textboxInitialEpsilon"] as TextBox;
            //Rewards
            wall_punishment_textbox         = groupbox_rewards.Controls["textboxInitialWallpunishment"] as TextBox;
            empty_square_punishment_textbox = groupbox_rewards.Controls["textboxInitialEmptysquare"] as TextBox;
            beer_reward_textbox             = groupbox_rewards.Controls["textboxInitialBeerreward"] as TextBox;
            successful_move_textbox         = groupbox_rewards.Controls["textboxRewardssuccessmove"] as TextBox;

            //Q-Matrix view
            qmatrix_state_combobox_large = groupbox_matrix_select.Controls["comboboxQmatrixselect"] as ComboBox;
            qmatrix_stored_entires       = groupbox_qmatrix.Controls["textboxQmatrixentries"] as TextBox;

            list_qmatrix_comboboxes = new Dictionary <Move, ComboBox>();
            list_qmatrix_comboboxes[Move.left()]  = groupbox_matrix_select.Controls["comboboxLeft"] as ComboBox;
            list_qmatrix_comboboxes[Move.right()] = groupbox_matrix_select.Controls["comboboxRight"] as ComboBox;
            list_qmatrix_comboboxes[Move.up()]    = groupbox_matrix_select.Controls["comboboxUp"] as ComboBox;
            list_qmatrix_comboboxes[Move.down()]  = groupbox_matrix_select.Controls["comboboxDown"] as ComboBox;
            list_qmatrix_comboboxes[Move.grab()]  = groupbox_matrix_select.Controls["comboboxCurrentsquare"] as ComboBox;

            List_qmatrix_value_textboxes = new Dictionary <Move, TextBox>();
            List_qmatrix_value_textboxes[Move.left()]  = groupbox_qmatrix_values.Controls["textboxQmatrixleft"] as TextBox;
            List_qmatrix_value_textboxes[Move.right()] = groupbox_qmatrix_values.Controls["textboxQmatrixright"] as TextBox;
            List_qmatrix_value_textboxes[Move.down()]  = groupbox_qmatrix_values.Controls["textboxQmatrixdown"] as TextBox;
            List_qmatrix_value_textboxes[Move.up()]    = groupbox_qmatrix_values.Controls["textboxQmatrixup"] as TextBox;
            List_qmatrix_value_textboxes[Move.grab()]  = groupbox_qmatrix_values.Controls["textboxQmatrixcurrent"] as TextBox;



            //Session progress
            step_number    = groupbox_session_progress.Controls["textboxStepsprogress"] as TextBox;
            episode_number = groupbox_session_progress.Controls["textboxEpisodesprogress"] as TextBox;
            e_session      = groupbox_session_progress.Controls["textboxEprogress"] as TextBox;
            y_session      = groupbox_session_progress.Controls["textboxYprogress"] as TextBox;

            //Can data and reward data
            beer_remaining = groupbox_can_data.Controls["textboxCansremaining"] as TextBox;
            beer_collected = groupbox_can_data.Controls["textboxCanscollected"] as TextBox;
            reward_episode = groupbox_reward_data.Controls["textboxRewardepisode"] as TextBox;
            reward_total   = groupbox_reward_data.Controls["textboxRewardtotal"] as TextBox;

            //Current position
            list_current_position_textboxes = new Dictionary <Move, TextBox>();
            list_current_position_textboxes[Move.left()]  = groupbox_current_position.Controls["textboxLeft"] as TextBox;
            list_current_position_textboxes[Move.right()] = groupbox_current_position.Controls["textboxRight"] as TextBox;
            list_current_position_textboxes[Move.up()]    = groupbox_current_position.Controls["textboxUp"] as TextBox;
            list_current_position_textboxes[Move.down()]  = groupbox_current_position.Controls["textboxDown"] as TextBox;
            list_current_position_textboxes[Move.grab()]  = groupbox_current_position.Controls["textboxCurrentsquare"] as TextBox;

            //Add all these textboxes to a list
            list_session_progress = new List <TextBox>();
            foreach (var i in list_current_position_textboxes)
            {
                list_session_progress.Add(i.Value);
            }
            foreach (var i in List_qmatrix_value_textboxes)
            {
                list_session_progress.Add(i.Value);
            }

            list_session_progress.Add(step_number);
            list_session_progress.Add(episode_number);
            list_session_progress.Add(e_session);
            list_session_progress.Add(y_session);
            list_session_progress.Add(beer_remaining);
            list_session_progress.Add(beer_collected);
            list_session_progress.Add(reward_episode);
            list_session_progress.Add(reward_total);
            list_session_progress.Add(qmatrix_stored_entires);

            //Control progess
            groupbox_control_progress = form1_control.Controls["groupboxAlgorithmprogress"] as GroupBox;
            control_progress_steps    = groupbox_control_progress.Controls["comboboxAdvancesteps"] as ComboBox;
            control_progress_episodes = groupbox_control_progress.Controls["comboboxAdvanceepisodes"] as ComboBox;
            control_progress_delay    = groupbox_control_progress.Controls["comboboxDelayms"] as ComboBox;


            //Status message
            status_box = form1_control.Controls["groupboxStatusmessage"].Controls["textboxStatus"] as RichTextBox;

            //History
            groupbox_history          = form1_control.Controls["groupboxHistory"] as GroupBox;
            combobox_history_episodes = groupbox_history.Controls["comboboxHistoryepisode"] as ComboBox;
            combobox_history_steps    = groupbox_history.Controls["comboboxHistorystep"] as ComboBox;
        }