Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 public void TestGeneral()
 {
     var anneal = new DiscreteAnnealSubclass(1000, 4000, 1) {Cycles = 100};
     Assert.AreEqual(100, anneal.Cycles);
     Assert.AreEqual(0, anneal.K);
     Assert.AreEqual(false, anneal.Done);
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public void TestGeneral()
        {
            var anneal = new DiscreteAnnealSubclass(1000, 4000, 1)
            {
                Cycles = 100
            };

            Assert.AreEqual(100, anneal.Cycles);
            Assert.AreEqual(0, anneal.K);
            Assert.AreEqual(false, anneal.Done);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 public void TestStatus()
 {
     var anneal = new DiscreteAnnealSubclass(1000, 4000, 1);
     Assert.AreEqual("k=0,kMax=1000,t=0,prob=0", anneal.Status);
 }
Exemplo n.º 10
0
        public void TestStatus()
        {
            var anneal = new DiscreteAnnealSubclass(1000, 4000, 1);

            Assert.AreEqual("k=0,kMax=1000,t=0,prob=0", anneal.Status);
        }