private void NetworkPresenter_SizeChanged(object sender, EventArgs e)
        {
            CtlNetworkPresenter.Height = Math.Max(CtlNetworkPresenter.Height, 400);

            if (NetworksManager != null)
            {
                var ticks = DateTime.UtcNow.Ticks;
                CtlNetworkPresenter.ResizeTicks = ticks;

                CtlNetworkPresenter.Dispatch(() =>
                {
                    if (CtlNetworkPresenter.ResizeTicks != ticks)
                    {
                        return;
                    }

                    if (IsRunning)
                    {
                        CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel, CtlOnlyWeights.IsOn, CtlOnlyChangedWeights.IsOn, CtlHighlightChangedWeights.IsOn);
                    }
                    else
                    {
                        CtlNetworkPresenter.RenderStanding(NetworksManager.SelectedNetworkModel);
                    }
                }, DispatcherPriority.Background);
            }
        }
示例#2
0
 private void ApplyChangesToRunningNetworks()
 {
     lock (ApplyChangesLocker)
     {
         CtlInputDataPresenter.RearrangeWithNewPointsCount();
         var newModels = NetworksManager.CreateNetworksDataModels();
         NetworksManager.MergeModels(newModels);
         CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel);
         ToggleApplyChanges(Const.Toggle.Off);
     }
 }
示例#3
0
        private void NetworkPresenter_SizeChanged(object sender, EventArgs e)
        {
            CtlNetworkPresenter.Height = Math.Max(CtlNetworkPresenter.Height, 400);

            if (NetworksManager != null)
            {
                CtlNetworkPresenter.Dispatch(() =>
                {
                    if (IsRunning)
                    {
                        CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel);
                    }
                    else
                    {
                        CtlNetworkPresenter.RenderStanding(NetworksManager.SelectedNetworkModel);
                    }
                });
            }
        }
示例#4
0
        private void CtlTabs_SelectedIndexChanged(object sender, EventArgs e)
        {
            // newly selected network must not affect NetworksManager until it saved

            if (NetworksManager != null)
            {
                if (IsRunning)
                {
                    lock (ApplyChangesLocker)
                    {
                        CtlInputDataPresenter.SetInputDataAndDraw(NetworksManager.Models.First());
                        CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel);
                        CtlPlotPresenter.Draw(NetworksManager.Models, NetworksManager.SelectedNetworkModel);
                        CtlStatisticsPresenter.Draw(null);
                    }
                }
                else
                {
                    CtlNetworkPresenter.RenderStanding(NetworksManager.SelectedNetworkModel);
                }
            }
        }
        private void CtlTabs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // newly selected network must not affect NetworksManager until it saved

            if (NetworksManager != null)
            {
                if (IsRunning)
                {
                    lock (ApplyChangesLocker)
                    {
                        CtlInputDataPresenter.SetInputDataAndDraw(NetworksManager.Models[0]);
                        CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel, CtlOnlyWeights.IsOn, CtlOnlyChangedWeights.IsOn, CtlHighlightChangedWeights.IsOn);
                        CtlPlotPresenter.Draw(NetworksManager.Models, NetworksManager.SelectedNetworkModel);
                        CtlStatisticsPresenter.Draw(NetworksManager.SelectedNetworkModel.LastStatistics);
                    }
                }
                else
                {
                    CtlNetworkPresenter.RenderStanding(NetworksManager.SelectedNetworkModel);
                }
            }
        }
示例#6
0
        private void DrawModels(List <NetworkDataModel> models)
        {
            var renderStart = DateTime.Now;

            CtlNetworkPresenter.RenderRunning(NetworksManager.SelectedNetworkModel);
            CtlInputDataPresenter.SetInputDataAndDraw(NetworksManager.Models.First());

            foreach (var model in models)
            {
                model.DynamicStatistic.Add(model.Statistic.Percent, model.Statistic.AverageCost);
            }

            CtlPlotPresenter.Draw(models, NetworksManager.SelectedNetworkModel);

            var selected = NetworksManager.SelectedNetworkModel;

            if (selected == null)
            {
                CtlStatisticsPresenter.Draw(null);
            }
            else
            {
                var stat = new Dictionary <string, string>();
                var span = DateTime.Now.Subtract(StartTime);
                stat.Add("Time", new DateTime(span.Ticks).ToString(@"HH\:mm\:ss"));

                if (selected.Statistic.Percent > 0)
                {
                    var remains = new DateTime((long)(span.Ticks * 100 / selected.Statistic.Percent) - span.Ticks);
                    stat.Add("Time remaining", new DateTime(remains.Ticks).ToString(@"HH\:mm\:ss"));
                }
                else
                {
                    stat.Add("Time remaining", "N/A");
                }

                if (selected.Statistic.LastGoodOutput > -1)
                {
                    stat.Add("Last good output", $"{selected.Statistic.LastGoodInput}={selected.Statistic.LastGoodOutput} ({Converter.DoubleToText(100 * selected.Statistic.LastGoodOutputActivation, "N6")}%)");
                    stat.Add("Last good cost", Converter.DoubleToText(selected.Statistic.LastGoodCost, "N6"));
                }
                else
                {
                    stat.Add("Last good output", "none");
                    stat.Add("Last good cost", "none");
                }

                if (selected.Statistic.LastBadOutput > -1)
                {
                    stat.Add("Last bad output", $"{selected.Statistic.LastBadInput}={selected.Statistic.LastBadOutput} ({Converter.DoubleToText(100 * selected.Statistic.LastBadOutputActivation, "N6")}%)");
                    stat.Add("Last bad cost", Converter.DoubleToText(selected.Statistic.LastBadCost, "N6"));
                }
                else
                {
                    stat.Add("Last bad output", "none");
                    stat.Add("Last bad cost", "none");
                }

                stat.Add("Average cost", Converter.DoubleToText(selected.Statistic.AverageCost, "N6"));
                stat.Add("Percent", Converter.DoubleToText(selected.Statistic.Percent, "N6") + " %");
                stat.Add("Learning rate", Converter.DoubleToText(selected.LearningRate));
                stat.Add("Rounds", Round.ToString());
                stat.Add("Rounds/sec", ((int)((double)Round / DateTime.Now.Subtract(StartTime).TotalSeconds)).ToString());

                var renderStop = DateTime.Now;

                stat.Add("Render time, msec", ((int)(renderStop.Subtract(renderStart).TotalMilliseconds)).ToString());
                CtlStatisticsPresenter.Draw(stat);
            }

            NetworksManager.ResetModelsStatistic();
        }
 private void DrawNetwork(NetworkDataModel model, bool isOnlyWeights, bool isOnlyChangedWeights, bool isHighlightChangedWeights)
 {
     CtlNetworkPresenter.RenderRunning(model, isOnlyWeights, isOnlyChangedWeights, isHighlightChangedWeights);
     CtlInputDataPresenter.SetInputDataAndDraw(model);
 }