diff --git a/.vs/comivoyar/v15/.suo b/.vs/comivoyar/v15/.suo index 7ea98a4..a976900 100644 Binary files a/.vs/comivoyar/v15/.suo and b/.vs/comivoyar/v15/.suo differ diff --git a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm index 2f6fb4d..66fb211 100644 Binary files a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm and b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal index 3f18657..39e1a83 100644 Binary files a/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal and b/.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal differ diff --git a/comivoyar/Program.cs b/comivoyar/Program.cs index 75a8518..13d5d0b 100644 --- a/comivoyar/Program.cs +++ b/comivoyar/Program.cs @@ -49,11 +49,11 @@ namespace komvo for (int i = 0; i <= toSwap.Length - 1; i++) toSwap[i] = i + 2; - for (int i = 0; i < toSwap.Length; i++) WriteLine(toSwap[i]); + //for (int i = 0; i < toSwap.Length; i++) WriteLine(toSwap[i]); int fct = Fact(Points.Count - 1); - int[] routes = new int[fct]; + string[] routes = new string[fct]; double[] leng = new double[fct]; double optim = leng[0]; @@ -64,19 +64,20 @@ namespace komvo foreach(IList p in perm) { string res = string.Empty; - for (int i = 0; i < toSwap.Length; i++) res += p[i].ToString(); - routes[index++] = int.Parse(res); + for (int i = 0; i < toSwap.Length; i++) res += p[i].ToString() + ";"; + routes[index++] = res; } - for (int i = 0; i < routes.Length; i++) WriteLine(routes[i]); + //for (int i = 0; i < routes.Length; i++) WriteLine(routes[i]); - CountLen(ref leng, Matrix, routes); + //CountLen(ref leng, Matrix, routes); + CountLen2(ref leng, Matrix, routes); SearchBest(ref optim, ref oIndex, routes, leng); - Debug(routes); + //Debug(routes); WriteLine("\n\n1{1}1 - оптимальный маршрут длинной {0:00.00}\nВсего маршрутов {2}\n{4} {3}", optim, routes[oIndex], routes.Length, fct, Points.Count); @@ -86,12 +87,47 @@ namespace komvo ReadKey(); } - public static void CountLen (ref double[] result, double[,] mtr, int[] rts) + + public static void CountLen2(ref double[] result, double[,] mtr, string[] rts) + { + //WriteLine("loading 00%"); + for (int i = 0; i < rts.Length; i++) + { + double res = 0; + //char[] ch = rts[i].ToCharArray(); + //CursorLeft -= 3; + //int percent = i / rts.Length * 100; + //Write("{0:00}%"); + + string[] index = rts[i].Split(';'); + + for (int j = 0; j < index.Length - 1; j++) + { + string dg = index[j]; + int db = int.Parse(index[j]) - 2; //debug + string db1 = rts[i].ToString(); //debug + if (j == 0) res += mtr[0, int.Parse(index[j]) - 1]; + else if (j == index.Length - 1) + { + res += mtr[int.Parse(index[j - 1]) - 2, int.Parse(index[j]) - 2]; + res += mtr[0, int.Parse(index[j]) - 2]; + } + else + { + res += mtr[int.Parse(index[j - 1]) - 2, int.Parse(index[j]) - 2]; + } + } + result[i] = res; + } + } + + + public static void CountLen (ref double[] result, double[,] mtr, string[] rts) { for (int i = 0; i < rts.Length; i++) { double res = 0; - char[] ch = rts[i].ToString().ToCharArray(); + char[] ch = rts[i].ToCharArray(); for (int j = 0; j < ch.Length; j++) { int db = int.Parse(ch[j].ToString()) - 1; //debug @@ -111,13 +147,13 @@ namespace komvo } } - public static void SearchBest(ref double optim, ref int oIndex, int[] routes, double[] leng) + public static void SearchBest(ref double optim, ref int oIndex, string[] routes, double[] leng) { optim = leng[0]; oIndex = 0; for (int i = 0; i < leng.Length; i++) { - WriteLine("{0:N2} - {1}", leng[i], routes[i]); + //WriteLine("{0:N2} - {1}", leng[i], routes[i]); if (optim > leng[i]) { optim = leng[i]; @@ -126,7 +162,7 @@ namespace komvo } } - public static void Debug (int[] routes) + public static void Debug (string[] routes) { for (int i = 0; i < routes.Length; i++) { diff --git a/comivoyar/bin/Debug/comivoyar.exe b/comivoyar/bin/Debug/comivoyar.exe index f3917ba..ede5e37 100644 Binary files a/comivoyar/bin/Debug/comivoyar.exe and b/comivoyar/bin/Debug/comivoyar.exe differ diff --git a/comivoyar/bin/Debug/comivoyar.pdb b/comivoyar/bin/Debug/comivoyar.pdb index 0773888..c63c666 100644 Binary files a/comivoyar/bin/Debug/comivoyar.pdb and b/comivoyar/bin/Debug/comivoyar.pdb differ diff --git a/comivoyar/bin/Debug/coord.txt b/comivoyar/bin/Debug/coord.txt index a576544..8012c37 100644 --- a/comivoyar/bin/Debug/coord.txt +++ b/comivoyar/bin/Debug/coord.txt @@ -1,6 +1,10 @@ 0 0 10 10 -20 20 -30 30 -40 40 -50 50 \ No newline at end of file +30 20 +20 30 +10 40 +20 50 +10 60 +50 70 +20 80 +30 100 \ No newline at end of file diff --git a/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 45d9c4c..bf5adb2 100644 Binary files a/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache b/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache index aa00d1d..37d3024 100644 --- a/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache +++ b/comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -47ece507326a3ff73baa3b75434a7d03f71dc86d +f0bb9fd207d6bf2b73407612668fe4a2e047ddf3 diff --git a/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt b/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt index 4f9f63b..6a522f2 100644 --- a/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt +++ b/comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt @@ -32,3 +32,23 @@ E:\кк\прог\comivoyar\comivoyar\bin\Debug\System.Security.Cryptography.X509 E:\кк\прог\comivoyar\comivoyar\bin\Debug\Combinatorics.xml E:\кк\прог\comivoyar\comivoyar\bin\Debug\System.Diagnostics.DiagnosticSource.xml E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csproj.CopyComplete +D:\Git\comvo\comivoyar\bin\Debug\Combinatorics.dll +D:\Git\comvo\comivoyar\bin\Debug\Microsoft.Win32.Primitives.dll +D:\Git\comvo\comivoyar\bin\Debug\System.AppContext.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Console.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Diagnostics.DiagnosticSource.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Globalization.Calendars.dll +D:\Git\comvo\comivoyar\bin\Debug\System.IO.Compression.dll +D:\Git\comvo\comivoyar\bin\Debug\System.IO.Compression.ZipFile.dll +D:\Git\comvo\comivoyar\bin\Debug\System.IO.FileSystem.dll +D:\Git\comvo\comivoyar\bin\Debug\System.IO.FileSystem.Primitives.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Net.Http.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Net.Sockets.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Runtime.InteropServices.RuntimeInformation.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Security.Cryptography.Algorithms.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Security.Cryptography.Encoding.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Security.Cryptography.Primitives.dll +D:\Git\comvo\comivoyar\bin\Debug\System.Security.Cryptography.X509Certificates.dll +D:\Git\comvo\comivoyar\bin\Debug\Combinatorics.xml +D:\Git\comvo\comivoyar\bin\Debug\System.Diagnostics.DiagnosticSource.xml +D:\Git\comvo\comivoyar\obj\Debug\comivoyar.csproj.CopyComplete diff --git a/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache b/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache index 6e0c1c9..d393437 100644 Binary files a/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache and b/comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache differ diff --git a/comivoyar/obj/Debug/comivoyar.exe b/comivoyar/obj/Debug/comivoyar.exe index f3917ba..ede5e37 100644 Binary files a/comivoyar/obj/Debug/comivoyar.exe and b/comivoyar/obj/Debug/comivoyar.exe differ diff --git a/comivoyar/obj/Debug/comivoyar.pdb b/comivoyar/obj/Debug/comivoyar.pdb index 0773888..c63c666 100644 Binary files a/comivoyar/obj/Debug/comivoyar.pdb and b/comivoyar/obj/Debug/comivoyar.pdb differ