Ejemplo n.º 1
0
 public void TestProbability()
 {
     var anneal = new DiscreteAnnealSubclass(1000, 400, 1);
     Assert.AreEqual(0.9753099120283326, anneal.CalcProbability(10, 20, anneal.CoolingSchedule()), AIFH.DefaultPrecision);
     anneal.Iteration();
     Assert.AreEqual(0.9751633961486054, anneal.CalcProbability(10, 20, anneal.CoolingSchedule()), AIFH.DefaultPrecision);
 }
Ejemplo n.º 2
0
 public void TestCoolingSchedule()
 {
     var anneal = new DiscreteAnnealSubclass(1000, 400, 1);
     Assert.AreEqual(400, anneal.CoolingSchedule(), AIFH.DefaultPrecision);
     anneal.Iteration();
     Assert.AreEqual(397.61057939346017, anneal.CoolingSchedule(), AIFH.DefaultPrecision);
 }
Ejemplo n.º 3
0
        public void TestProbability()
        {
            var anneal = new DiscreteAnnealSubclass(1000, 400, 1);

            Assert.AreEqual(0.9753099120283326, anneal.CalcProbability(10, 20, anneal.CoolingSchedule()), AIFH.DefaultPrecision);
            anneal.Iteration();
            Assert.AreEqual(0.9751633961486054, anneal.CalcProbability(10, 20, anneal.CoolingSchedule()), AIFH.DefaultPrecision);
        }
Ejemplo n.º 4
0
        public void TestCoolingSchedule()
        {
            var anneal = new DiscreteAnnealSubclass(1000, 400, 1);

            Assert.AreEqual(400, anneal.CoolingSchedule(), AIFH.DefaultPrecision);
            anneal.Iteration();
            Assert.AreEqual(397.61057939346017, anneal.CoolingSchedule(), AIFH.DefaultPrecision);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }