public void TestZeroOneCorrectness() { var task = TaskGenerator.GetPredictableTask(); AbstractBackpack b = new ExhausiveSearchBackpack(task.Item2); bool[] result = b.SolveZeroOne(task.Item1); Assert.IsTrue(b.TotalCost(task.Item1, result) == 36); Assert.IsTrue(b.TotalWeight(task.Item1, result) <= task.Item2); }
public void TestElapsedTime() { Stopwatch sw = new Stopwatch(); var task = TaskGenerator.GetRandomTask(25); AbstractBackpack b = new ExhausiveSearchBackpack(task.Item2); sw.Start(); bool[] result = b.SolveZeroOne(task.Item1); sw.Stop(); Trace.WriteLine(string.Format("{0} c", (double)sw.ElapsedMilliseconds / 1000)); }