Пример #1
0
        public Initializer()
        {
            new FileChecker();
            _saver        = new MainSaver(_logger);
            this.Settings = new Settings(_logger);
            Settings.SetSavePath(ConfigSaveLocation);
            Settings.Load();

            if (Settings.Get <bool>(_names.Console))
            {
                _logger.ChangeLogger(new ConsoleLogger(Settings));
            }
            else
            {
                _logger.ChangeLogger(new EmptyLogger());
            }
            _logger.AddLogger(new FileLogger(_saver, Settings));

            _logger.Log("booting up...", LogLevel.Basic);
        }
        /// <summary>
        /// Создаем простую трехслойную нейросеть.
        /// Создаем нейроны, генерируем между ними связи со случайными значениями весов.
        /// </summary>
        private void _createNeuralNetworkBtn_Click(object sender, EventArgs e)
        {
            _neural3NetworkProperties = new Neural3NetworkProperties(this, Neural3NetworkCreator);

            var functionActivation  = _neural3NetworkProperties.FuncActivation;
            var amountInputNeurons  = _neural3NetworkProperties.AmountInputNeurons;
            var amountHiddenNeurons = _neural3NetworkProperties.AmountHiddenNeurons;
            var amountOutputNeurons = _neural3NetworkProperties.AmountOutputNeurons;
            var minWeight           = _neural3NetworkProperties.MinWeight;
            var maxWeight           = _neural3NetworkProperties.MaxWeight;

            Neural3NetworkCreator = new Neural3NetworkCreator(functionActivation, amountInputNeurons, amountHiddenNeurons, amountOutputNeurons, minWeight, maxWeight);

            _mainLogger.Log("Трехслойная нейросеть успешна создана.", isShowMsg: true);
            UIHelper.ChangeStatusLabel(_creatingNNStsLbl, true);
        }
Пример #3
0
        internal bool GoOnline(bool online = true, bool forceAction = false, IProgressEx Progress = null)
        {
            if (online)
            {
                try
                {
                    _target.Connect(Progress);
                }
                catch (Exception ex)
                {
                    MainLogger.Log(ex);
                    return(false);
                }

                if (!forceAction)
                {
                    foreach (DynComponent component in ComponentSet)
                    {
                        if (!component.CanGoOnline())
                        {
                            MainLogger.Log(string.Format("Component '{0}' can not go online", component.Ident), 0,
                                           LogMessageType.Exclamation, LogReceiver.Console);
                            return(false);
                        }
                    }

                    foreach (KeyValuePair <string, DynView> entry in ViewSet.ViewsList)
                    {
                        if (!entry.Value.CanGoOnline())
                        {
                            MainLogger.Log(string.Format("View '{0}' can not go online", entry.Value.Name), 0,
                                           LogMessageType.Exclamation, LogReceiver.Console);
                            return(false);
                        }
                    }
                }
            }
            else
            {
                if (!forceAction)
                {
                    foreach (DynComponent component in ComponentSet)
                    {
                        if (!component.CanGoOffline())
                        {
                            MainLogger.Log(string.Format("Component '{0}' can not go offline", component.Ident), 0,
                                           LogMessageType.Exclamation, LogReceiver.Console);
                            return(false);
                        }
                    }

                    foreach (KeyValuePair <string, DynView> entry in ViewSet.ViewsList)
                    {
                        if (!entry.Value.CanGoOffline())
                        {
                            MainLogger.Log(string.Format("View '{0}' can not go offline", entry.Value.Name), 0,
                                           LogMessageType.Exclamation, LogReceiver.Console);
                            return(false);
                        }
                    }
                }
            }

            foreach (DynComponent component in ComponentSet)
            {
                if (online)
                {
                    if (!component.GoOnline())
                    {
                        GoOffline(Progress);

                        if (!forceAction)
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    component.GoOffline();
                }
            }

            foreach (KeyValuePair <string, DynView> entry in ViewSet.ViewsList)
            {
                if (online)
                {
                    if (!entry.Value.GoOnline())
                    {
                        GoOffline(Progress);

                        if (!forceAction)
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    entry.Value.GoOffline();
                }
            }

            if (!online)
            {
                try
                {
                    _target.Disconnect(Progress);
                }
                catch (Exception)
                {
                }
            }

            _isOnline = online;

            return(true);
        }