public void HasOptimalTourShouldMatchThatOfInfoProvider() { // arrange const string problemName = "eil76"; var loader = new SymmetricTspItemLoader(Helpers.LibPath); var item = loader.GetItem(problemName); var infoProvider = new SymmetricTspItemInfoProvider(item); var manager = new TspLibItemManager(Helpers.LibPath); // act manager.LoadItem(problemName); // assert Assert.AreEqual(infoProvider.HasOptimalTour, manager.HasOptimalTour); }
public void DistancesShouldMatchThatOfInfoProvider() { // arrange const string problemName = "eil76"; var loader = new SymmetricTspItemLoader(Helpers.LibPath); var item = loader.GetItem(problemName); var infoProvider = new SymmetricTspItemInfoProvider(item); var manager = new TspLibItemManager(Helpers.LibPath); // act manager.LoadItem(problemName); // assert CollectionAssert.AreEqual(infoProvider.Distances, manager.Distances); }
/// <summary>Loads the TSP library item corresponding to problemName.</summary> /// <param name="problemName">The name of the symmetric TSP problem to load</param> /// <exception cref="ArgumentException">Thrown if the problem could not be loaded.</exception> public void LoadItem(string problemName) { try { var currentItem = _itemLoader.GetItem(problemName); _infoProvider = new SymmetricTspItemInfoProvider(currentItem); } catch (ArgumentException e) { throw new ArgumentException("Could not load TSP problem", e); } }
public void MinMaxCoordinatesShouldMatchThatOfInfoProvider() { // arrange const string problemName = "eil76"; var loader = new SymmetricTspItemLoader(Helpers.LibPath); var item = loader.GetItem(problemName); var infoProvider = new SymmetricTspItemInfoProvider(item); var manager = new TspLibItemManager(Helpers.LibPath); // act manager.LoadItem(problemName); // assert Assert.AreEqual(infoProvider.MaxXCoordinate, manager.MaxXCoordinate); Assert.AreEqual(infoProvider.MaxYCoordinate, manager.MaxYCoordinate); Assert.AreEqual(infoProvider.MinXCoordinate, manager.MinXCoordinate); Assert.AreEqual(infoProvider.MinYCoordinate, manager.MinYCoordinate); }