Пример #1
0
 /// <summary>
 /// Adds a (xNorm,y) value to the series of evaluations.
 /// </summary>
 /// <param name="xNorm">The normalized value in x (0 is the beginning and 1 the end of the experiment)</param>
 /// <param name="y">The average reward obtained in this evaluation</param>
 public void AddEvaluationValue(double xNorm, double y)
 {
     if (m_seriesId == -1) //series not yet added
     {
         m_seriesId = m_plotEvaluationMonitor.AddLineSeries(Name);
     }
     m_plotEvaluationMonitor.AddLineSeriesValue(m_seriesId, xNorm, y);
 }
Пример #2
0
        public ReportViewModel(List <TrackGroup> queryResultTracks, LogQueryViewModel query, Report report)
        {
            Name = report.Name;

            //Create the plot
            PlotViewModel newPlot = new PlotViewModel(report.Name, "Time (s)", report.Name, false, true);
            //Create the stats
            StatsViewModel newStatGroup = new StatsViewModel(report.Name);

            foreach (TrackGroup group in queryResultTracks)
            {
                //plot data
                if (group.ConsolidatedTrack != null)
                {
                    SeriesGroup seriesGroup = group.ConsolidatedTrack.SeriesGroups[report];

                    foreach (Series series in seriesGroup.SeriesList)
                    {
                        string seriesName;
                        string description;
                        if (seriesGroup.SeriesList.Count == 1)
                        {
                            //only one series per track group, no multi-series track group
                            seriesName  = group.ConsolidatedTrack.TrackId;
                            description = group.ConsolidatedTrack.FullTrackId;
                        }
                        else
                        {
                            seriesName  = group.ConsolidatedTrack.TrackId + "-" + series.Id;
                            description = group.ConsolidatedTrack.FullTrackId + "-" + series.Id;
                        }

                        //add data to the plot
                        int lineSeriesId = newPlot.AddLineSeries(seriesName, description);
                        foreach (XYValue value in series.Values)
                        {
                            newPlot.AddLineSeriesValue(lineSeriesId, value.X, value.Y);
                        }

                        StatViewModel newStat =
                            new StatViewModel(group.ExperimentId, seriesName, series.Stats
                                              , group.ConsolidatedTrack.LogBinaryFile
                                              , group.ConsolidatedTrack.LogDescriptorFile
                                              , group.ConsolidatedTrack.ExperimentalUnitConfigFile);

                        newStatGroup.addStat(newStat);
                    }
                }
            }
            Plot  = newPlot;
            Stats = newStatGroup;
        }
        public void OnMessageReceived(string experimentId, string messageId, string messageContent)
        {
            MonitoredExperimentalUnitViewModel experimentVM = ViewModelFromName[experimentId];

            if (experimentVM == null)
            {
                m_logFunction?.Invoke("Could not find the View-Model for experiment " + experimentId);
            }
            else
            {
                experimentVM.LastHeartbeat = DateTime.Now;
                LastHeartbeat = DateTime.Now;
                switch (messageId)
                {
                case JobDispatcher.ProgressMessage:
                    double progress = double.Parse(messageContent, CultureInfo.InvariantCulture);
                    experimentVM.Progress = Convert.ToInt32(progress);
                    break;

                case JobDispatcher.EvaluationMessage:
                    //<Evaluation>0.0,-1.23</Evaluation>
                    string[] values     = messageContent.Split(',');
                    string   seriesName = experimentVM.Name;
                    int      seriesId;
                    if (values.Length == 2)
                    {
                        if (!m_experimentSeriesId.Keys.Contains(experimentVM.Name))
                        {
                            seriesId = m_evaluationPlot.AddLineSeries(seriesName);
                            m_experimentSeriesId.Add(seriesName, seriesId);
                        }
                        else
                        {
                            seriesId = m_experimentSeriesId[seriesName];
                        }

                        m_evaluationPlot.AddLineSeriesValue(seriesId, double.Parse(values[0], CultureInfo.InvariantCulture)
                                                            , double.Parse(values[1], CultureInfo.InvariantCulture));
                    }
                    break;

                case JobDispatcher.GeneralMessage:
                    experimentVM.AddStatusInfoLine(messageContent);
                    break;

                case JobDispatcher.EndMessage:
                    if (messageContent == JobDispatcher.EndMessageOk || messageContent == "")
                    {
                        m_logFunction?.Invoke("Job finished sucessfully");
                        experimentVM.State = Monitoring.State.WAITING_RESULT;
                    }
                    else
                    {
                        m_logFunction?.Invoke("Remote job execution wasn't successful");
                        //Right now, my view on adding failed experiments back to the pending exp. list:
                        //Some experiments may fail because the parameters are just invalid (i.e. FAST)
                        //Much more likely than a network-related error or some other user-related problem
                        //FailedExperiments.Add(experimentVM);
                        experimentVM.State = Monitoring.State.ERROR;
                    }
                    break;
                }
            }
        }
Пример #4
0
        public ReportViewModel(List <TrackGroup> queryResultTracks, LogQueryViewModel query, Report report)
        {
            Name = report.Name;

            //Create the plot
            PlotViewModel newPlot = new PlotViewModel(report.Name, "Time (s)", report.Name, false, true);

            if (!query.AverageSelectedTracks)
            {
                //Create the stats
                StatsViewModel newStatGroup = new StatsViewModel(report.Name);

                //Regular line series
                foreach (TrackGroup group in queryResultTracks)
                {
                    if (group.ConsolidatedTrack != null)
                    {
                        SeriesGroup seriesGroup = group.ConsolidatedTrack.SeriesGroups[report];

                        foreach (Series series in seriesGroup.SeriesList)
                        {
                            string seriesName;
                            string description;
                            if (seriesGroup.SeriesList.Count == 1)
                            {
                                //only one series per track group, no multi-series track group
                                seriesName  = group.ConsolidatedTrack.TrackId;
                                description = group.ConsolidatedTrack.FullTrackId;
                            }
                            else
                            {
                                seriesName  = group.ConsolidatedTrack.TrackId + "-" + series.Id;
                                description = group.ConsolidatedTrack.FullTrackId + "-" + series.Id;
                            }

                            //add data to the plot
                            int lineSeriesId = newPlot.AddLineSeries(seriesName, description);

                            //force resampling if point count is over 100
                            if (series.Values.Count > 100)
                            {
                                series.Resample(100);
                            }

                            foreach (XYValue value in series.Values)
                            {
                                newPlot.AddLineSeriesValue(lineSeriesId, value.X, value.Y);
                            }

                            StatViewModel newStat =
                                new StatViewModel(group.ExperimentId, seriesName, series.Stats
                                                  , group.ConsolidatedTrack.LogBinaryFile
                                                  , group.ConsolidatedTrack.LogDescriptorFile
                                                  , group.ConsolidatedTrack.ExperimentalUnitConfigFile);

                            newStatGroup.addStat(newStat);
                        }
                    }
                }
                Stats = newStatGroup;
            }
            else
            {
                List <Series> originalSeries = new List <Series>();
                foreach (TrackGroup group in queryResultTracks)
                {
                    //Averaged line series: we need to average all the track groups
                    SeriesGroup seriesGroup = group.ConsolidatedTrack.SeriesGroups[report];

                    //take the first series
                    originalSeries.Add(seriesGroup.SeriesList[0]);
                }

                Series.AverageSeriesList(originalSeries, out Series averages, out Series minimums, out Series maximums);

                //only one series per track group, no multi-series track group
                string seriesName  = "Averaged series";
                string description = "Averaged series";

                //add a line series to the plot
                int lineSeriesId = newPlot.AddLineSeries(seriesName, description);
                int areaSeriesId = newPlot.AddAreaSeries(seriesName, description);

                //all three output series must have the same number of elements
                int sampleCount = averages.Values.Count;
                for (int sample = 0; sample < sampleCount; sample++)
                {
                    newPlot.AddLineSeriesValue(lineSeriesId, averages.Values[sample].X, averages.Values[sample].Y);
                    newPlot.AddAreaSeriesValue(areaSeriesId, averages.Values[sample].X, minimums.Values[sample].Y, maximums.Values[sample].Y);
                }
            }

            Plot = newPlot;
        }