public void GetItemByInvalidName() { var tspLib = new TspLib95(RootDir); tspLib.LoadAllTSP(); Assert.IsNull(tspLib.GetItemByName("bob", ProblemType.TSP)); Assert.IsNull(tspLib.GetItemByName("", ProblemType.TSP)); Assert.IsNull(tspLib.GetItemByName(" ", ProblemType.TSP)); }
private static double TspCanonicalDistance(string problemName, int nrNodes) { var tspLib = new TspLib95(RootDir); tspLib.LoadTSP(problemName); var problem = tspLib.GetItemByName(problemName, ProblemType.TSP).Problem; var nodes = Enumerable.Range(1, nrNodes); var tour = new Tour(problemName, "", nodes.Count(), nodes); return(problem.TourDistance(tour)); }