コード例 #1
0
        public void GetResult()
        {
            var network = new HopfieldNetwork();

            network.Train(new Dictionary <string, string>
            {
                { "1", Pattern1 },
                { "2", Pattern2 }
            });

            var result = network.GetResult(Pattern1);

            Assert.AreEqual(Pattern1, result);
        }
コード例 #2
0
        public void EvaluateEnergyFunctionTest()
        {
            var network = new HopfieldNetwork();

            network.Train(new Dictionary <string, string>
            {
                { "1", Pattern1 },
                { "2", Pattern2 }
            });

            var energyState = network.CurrentEnergyState;

            network.GetResult(Pattern3);

            Assert.IsTrue(network.CurrentEnergyState <= energyState);
        }