Ejemplo n.º 1
0
        public void TestDistanceCalc()
        {
            ICalculateDistance calc = new EuclideanDistance();
            double[] pos1 = { 0.5, 1.0, 2.5 };
            double[] pos2 = { 0.1, 2.0, -2.5 };

            Assert.AreEqual(5.1146, calc.Calculate(pos1, pos2), 0.001);
        }
Ejemplo n.º 2
0
        public void TestRun()
        {
            var anneal = new DiscreteAnnealSubclass(1000, 400, 1);
            while (!anneal.Done)
            {
                anneal.Iteration();
            }

            ICalculateDistance dist = new EuclideanDistance();

            Assert.AreEqual(1000, anneal.K);
            Assert.AreEqual(0, dist.Calculate(anneal.Best, DiscreteAnnealSubclass.Ideal), AIFH.DefaultPrecision);
            Assert.AreEqual(0, anneal.BestScore, AIFH.DefaultPrecision);
        }