public SocketOperationsImpl(EntityCache <CustomSocket> socketCache, EntityCache <SocketGroup> socketGroupCache,
                                    SocketExchange.SocketExchangeClient client, SocketOperationsOptions options)
        {
            _client           = client;
            _socketCache      = socketCache;
            _socketGroupCache = socketGroupCache;
            _options          = options;

            var sockets = _socketCache.GetAll();
            var productionRulesGenerator = new ProductionRulesGenerator();
            var logicRulesGenerator      = new LogicRulesGenerator();
            var fuzzyRulesGenerator      = new FuzzyRulesGenerator();
            var neuralRulesGenerator     = new NeuralRulesGenerator();

            // Продукционный вывод
            var rulesGraph = productionRulesGenerator.GenerateRules(sockets);
            // Логический вывод
            var logicRules = logicRulesGenerator.GenerateRules(sockets);
            // Нечеткий вывод
            var fuzzyDomains = fuzzyRulesGenerator.GetFuzzyDomains(sockets);
            var fuzzyFacts   = fuzzyRulesGenerator.GetFuzzyFacts(fuzzyDomains, sockets);
            // Нейро-нечеткий вывод
            var neuralNetwork = neuralRulesGenerator.GetNeuralNetwork(sockets);

            var processorOptions = new ProcessorOptions {
                Debug = _options.Debug
            };

            _productionProcessor = new ProductionProcessor(rulesGraph, processorOptions);
            _logicProcessor      = new LogicProcessor(logicRules, processorOptions);
            _fuzzyProcessor      = new FuzzyProcessor(fuzzyDomains, fuzzyFacts, processorOptions);
            _neuralProcessor     = new NeuralProcessor(neuralNetwork, processorOptions);
        }
Esempio n. 2
0
        private Program(ServerProgramOptions options) : base(options)
        {
            var channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);

            _client = new SocketExchange.SocketExchangeClient(channel);

            try
            {
                var message = _client.SayHello(new HelloMessage {
                    Version = Options.Version
                });
                Console.WriteLine($"Connected to SocketExchange v{message.Version} on 127.0.0.1:50051");
            }
            catch
            {
                Console.WriteLine("Error: Connection to SocketExchange on 127.0.0.1:50051 failed");
                Environment.Exit(1);
            }
        }