public void CreateProblemFromDbIntance() { var instanceRepository = new InstanceRepository(TopEntitiesManager.GetContext()); var intance = instanceRepository.GetBy("Tsiligirides", "Set_21_234", "p2.2.a.txt"); var problemResourceProvider = ProblemProviderFactory.CreateProblemProvider(intance); var problemDecoder = new ProblemDecoder(problemResourceProvider); var populationGenerator = new PopulationGenerator(problemDecoder, problemResourceProvider.GetAmountOfNonProfitDestinations()); var problemManager = new ProblemManager(populationGenerator, true) {MaxIterations = 1}; var brkga = new Brkga(problemManager); brkga.Start(); }
public void TestLoadedInstance() { var instanceRepository = new InstanceRepository(TopEntitiesManager.GetContext()); var intance = instanceRepository.GetBy("Tsiligirides", "Set_21_234", "p2.2.a.txt"); Assert.AreEqual(21, intance.DestiniesCount); Assert.AreEqual(2, intance.Vehicles); Assert.AreEqual(Convert.ToDecimal(7.5), intance.TMax); Assert.AreEqual(21, intance.Destinies.Count); var aDestiny = intance.Destinies.First(d => d.Id == 1); Assert.AreEqual(1, aDestiny.InstanceId); Assert.AreEqual(Convert.ToDecimal(4.60), aDestiny.X); Assert.AreEqual(Convert.ToDecimal(7.10), aDestiny.Y); Assert.AreEqual(0, aDestiny.Profit); var anotherDestiny = intance.Destinies.First(d => d.Id == 14); Assert.AreEqual(1, anotherDestiny.InstanceId); Assert.AreEqual(Convert.ToDecimal(6.70), anotherDestiny.X); Assert.AreEqual(Convert.ToDecimal(5.80), anotherDestiny.Y); Assert.AreEqual(25, anotherDestiny.Profit); }