Beispiel #1
0
        private void Train()
        {
            if (Convert.ToInt32(trainingEpisodesText.Text) != _agentPrimary.NumberOfTrainingEpisodes)
            {
                _agentPrimary.NumberOfTrainingEpisodes = Convert.ToInt32(trainingEpisodesText.Text);
            }

            if (_useSecondaryAgent)
            {
                _agentSecondary.NumberOfTrainingEpisodes = _agentPrimary.NumberOfTrainingEpisodes;
            }

            try
            {
                if (_trainingSessionSelector != null)
                {
                    _trainingSessionSelector.Dispose();
                    _trainingSessionSelector = null;
                }
            }
            catch { }

            _agentPrimary.State = _agentPrimary.StartPosition;
            var dlg = new TrainingProgress(_agentPrimary, (_useSecondaryAgent ? _agentSecondary : null));

            this.Cursor  = Cursors.WaitCursor;
            this.Enabled = false;

            try
            {
                AgentUnsubscribeEvents(_agentPrimary);
                AgentUnsubscribeEvents(_agentSecondary);

                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show($"An error occurred: {ex}");
            }
            finally
            {
                dlg.Dispose();
                _needsRetrain = false;

                this.Enabled = true;
                this.Cursor  = Cursors.Default;
            }

            GetEpisodeSelection();
            // _agentSecondary.Environment.QualityTable = _agentPrimary.Environment.QualityTable;
            AgentSubscribeEvents(_agentPrimary);
            AgentSubscribeEvents(_agentSecondary);
        }
Beispiel #2
0
        private void GetEpisodeSelection()
        {
            if (_trainingSessionSelector == null ||
                _trainingSessionSelector.IsDisposed)
            {
                _trainingSessionSelector = new TrainingSessionSelector(_agentPrimary);
            }

            if (_trainingSessionSelector.ShowDialog() == DialogResult.OK)
            {
                _agentPrimary.Environment.QualityTable = _trainingSessionSelector.SelectedSession.Quality;
            }
        }