public void AllProblemNamesShouldMatchThatOfItemLoader()
        {
            // arrange
              var loader = new SymmetricTspItemLoader(Helpers.LibPath);
              var manager = new TspLibItemManager(Helpers.LibPath);

              // assert
              Assert.AreEqual(loader.ProblemNames, manager.AllProblemNames);
        }
 /// <summary>
 /// Selects and loads symmetrical TSP problems with fewer than or equal to 100 nodes and
 /// 2D coordinate sets.  Automatically loads the first STSP instance available.
 /// </summary>
 /// <param name="tspLibPath">The directory path to the TSPLIB95 library.</param>
 /// <exception cref="ArgumentException">Thrown if no TSP items were loaded.</exception>
 public TspLibItemManager(string tspLibPath)
 {
     try
       {
     _itemLoader = new SymmetricTspItemLoader(tspLibPath);
     var problemName = _itemLoader.ProblemNames.First();
     LoadItem(problemName);
       }
       catch (ArgumentException e)
       {
     throw new ArgumentException("Could not load TSP items", e);
       }
 }
        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);
        }
        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);
        }