public void TestIterations() { var anneal = new TrainAnneal(new TrialAlgo(), new TrialScore(), 10, 400, 0.0001) {Cycles = 10}; Assert.AreEqual(400, anneal.CoolingSchedule(), AIFH.DefaultPrecision); Assert.AreEqual(400, anneal.StartingTemperature, AIFH.DefaultPrecision); Assert.AreEqual(0.0001, anneal.EndingTemperature, AIFH.DefaultPrecision); Assert.AreEqual(10, anneal.Cycles); Assert.AreEqual(0, anneal.CurrentTemperature, AIFH.DefaultPrecision); Assert.AreEqual(0, anneal.K); Assert.AreEqual(false, anneal.Done); Assert.AreEqual(true, double.IsInfinity(anneal.LastError)); Assert.AreEqual(0, anneal.LastProbability, AIFH.DefaultPrecision); anneal.Iteration(); Assert.AreEqual(true, anneal.LastError > 0); Assert.AreEqual(87.46896591546223, anneal.CurrentTemperature, AIFH.DefaultPrecision); Assert.AreEqual(1, anneal.K); Assert.AreEqual(false, anneal.Done); for (int i = 0; i < 9; i++) { anneal.Iteration(); } Assert.AreEqual(true, anneal.Done); Assert.AreEqual(9.999999999999E-5, anneal.CurrentTemperature, AIFH.DefaultPrecision); Assert.AreEqual(10, anneal.K); }
public void TestBasic() { var anneal = new TrainAnneal(new TrialAlgo(), new TrialScore()); Assert.AreEqual(400, anneal.CoolingSchedule(), AIFH.DefaultPrecision); }