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)); }
private void InitializeLibrary() { List <string> atsp = new List <string> { "br17", "ft53", "ft70", "ftv33", "ftv35", "ftv38", "ftv44", "ftv47", "ftv55", "ftv64", "ftv70", "ftv170", "kro124p", "p43", "rbg323", "rbg358", "rbg403", "rbg443", "ry48p" }; var name = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; string tspDir = name + "\\packages\\TSPLib.Net.1.1.5\\TSPLIB95"; _library = new TspLib95(tspDir); if (atsp.Contains(FilePath)) { _library.LoadATSP(FilePath); } else { _library.LoadTSP(FilePath); } }
public void LoadByNameNullDir() { var tspLib = new TspLib95(RootDir); tspLib.LoadTSP(""); }