コード例 #1
0
        public void SetExperiment(ExperimentBase experiment)
        {
            this.inhibitEvents = true;

            this.environment             = experiment.Environment;
            this.presentationEnvironment = experiment.PresentationEnvironment;
            this.experiment = experiment;

            foreach (RadioButton r in this.environmentPanel.Controls.Cast <RadioButton>())
            {
                r.Checked = r.Tag.Equals(this.environment.GetType());
            }

            RebuildAgentList(this.environment.ComponentType);

            foreach (RadioButton r in this.agentPanel.Controls.Cast <RadioButton>())
            {
                r.Checked = r.Tag.Equals(this.experiment.Agent.GetType());
            }

            RefreshTabPages();

            this.environmentParameterControl.Initialize(this.environment, true);
            this.agentParameterControl.Initialize(experiment.Agent, true);
            this.experimentParameterControl.Initialize(this.experiment, false);

            this.reportingConfigurationControl.Experiment = this.experiment;
            this.reportingConfigurationControl.SetReportFileWriters(experiment.Reporter.ReportWriters.Cast <ReportFileWriter>(), true);

            this.inhibitEvents = false;
        }
コード例 #2
0
        private void InstantiateExperiment(Component agent)
        {
            this.experiment = ExperimentBase.Instantiate(this.environment, this.presentationEnvironment, agent);

            this.experimentParameterControl.Initialize(this.experiment, false);
            this.reportingConfigurationControl.Experiment = this.experiment;
        }
コード例 #3
0
        public ExperimentWindow(ExperimentBase experiment)
        {
            this.context = BufferedGraphicsManager.Current;

            var presenterFactory = EnvironmentRegistry.GetPresenterFactoryForEnvironment(experiment.Environment.GetType());

            this.realTimeLearningPresenter   = presenterFactory(experiment.Environment);
            this.policyPresentationPresenter = presenterFactory(experiment.PresentationEnvironment);

            InitializeComponent();

            this.experiment       = experiment;
            this.experimentWorker = new ExperimentWorker(this.experiment);
            this.experimentWorker.ExperimentFinished += new EventHandler(ExperimentFinished);
            this.ownExperimentWorker = true;

            this.experimentWorker.ConfigureProgressBar(this.progressBar1);

            this.timer.Stop();
            this.timer.Interval = GlobalParameters.TimerInterval;

            InitGraphics();
            this.DoubleBuffered = true;

            this.progressBar1.Visible = true;
            this.timer.Interval       = GlobalParameters.TimerInterval;

            RefreshPresentationContent();
        }
コード例 #4
0
        private void LoadExperimentTemplateButtonClick(object sender, EventArgs e)
        {
            ExperimentBase experiment = ExperimentSetupWindow.LoadExperiment();

            if (experiment != null)
            {
                SetExperiment(experiment);
            }
        }
コード例 #5
0
        private void AddExperiment(ExperimentBase experiment)
        {
            this.experimentListBox.Items.Add(new ExperimentInfo()
            {
                Ordinal    = this.experimentListBox.Items.Count + 1,
                Experiment = experiment
            });

            this.experimentListBox.SelectedIndex = this.experimentListBox.Items.Count - 1;
        }
コード例 #6
0
        public ExperimentWorker(ExperimentBase experiment)
        {
            this.Experiment       = experiment;
            this.backgroundThread = null;

            this.semaphore          = new SemaphoreSlim(1, 1);
            this.initialized        = false;
            this.interruptRequested = false;

            ReconfigureProgress();
        }
コード例 #7
0
        public ExperimentBase Clone()
        {
            Component environment             = this.Environment.Clone();
            Component presentationEnvironment = this.PresentationEnvironment.Clone();
            Component agent = this.Agent.Clone();

            ExperimentBase result = ExperimentBase.Instantiate(environment, presentationEnvironment, agent);

            Reporter reporter = this.Reporter.CloneFor(result);

            result.Reporter = reporter;

            result.CopyParametersFrom(this);

            return(result);
        }
コード例 #8
0
        private void RefreshLabels(ExperimentBase experiment)
        {
            if (experiment == null)
            {
                this.environmentLabel.Text                = string.Empty;
                this.agentLabel.Text                      = string.Empty;
                this.experimentEpisodeCountLabel.Text     = string.Empty;
                this.experimentEpisodeStepCountLabel.Text = string.Empty;
                this.experimentTotalStepCountLabel.Text   = string.Empty;
                return;
            }

            this.environmentLabel.Text = experiment.Environment.GetType().GetDisplayName();
            this.agentLabel.Text       = experiment.Agent.GetType().GetDisplayName();

            if (experiment.EpisodeCountLimit > 0)
            {
                this.experimentEpisodeCountLabel.Text = experiment.EpisodeCountLimit + " episodes";
            }
            else
            {
                this.experimentEpisodeCountLabel.Text = "Unlimited number of episodes";
            }

            if (experiment.EpisodeStepCountLimit > 0)
            {
                this.experimentEpisodeStepCountLabel.Text = experiment.EpisodeStepCountLimit + " steps in episode";
            }
            else
            {
                this.experimentEpisodeStepCountLabel.Text = "Unlimited number of steps in episode";
            }

            if (experiment.TotalStepCountLimit > 0)
            {
                this.experimentTotalStepCountLabel.Text = experiment.TotalStepCountLimit + " total steps";
            }
            else
            {
                this.experimentTotalStepCountLabel.Text = "Unlimited number of total steps";
            }
        }