diff --git a/.vs/comivoyar/v15/.suo b/.vs/comivoyar/v15/.suo index 9c724f2..7ea98a4 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 533549f..2f6fb4d 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 43864b5..3f18657 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 a664daf..75a8518 100644 --- a/comivoyar/Program.cs +++ b/comivoyar/Program.cs @@ -45,16 +45,16 @@ namespace komvo WriteLine(); } - int[] toSwap = new int[Points.Count]; - for (int i = 0; i < toSwap.Length; i++) toSwap[i] = i + 2; + int[] toSwap = new int[Points.Count - 1]; + for (int i = 0; i <= toSwap.Length - 1; i++) toSwap[i] = i + 2; for (int i = 0; i < toSwap.Length; i++) WriteLine(toSwap[i]); int fct = Fact(Points.Count - 1); - int[] routes = new int[Fact(Points.Count)]; - double[] leng = new double[Fact(Points.Count)]; + int[] routes = new int[fct]; + double[] leng = new double[fct]; double optim = leng[0]; int oIndex = 0; @@ -68,6 +68,12 @@ namespace komvo routes[index++] = int.Parse(res); } + + for (int i = 0; i < routes.Length; i++) WriteLine(routes[i]); + + + + CountLen(ref leng, Matrix, routes); SearchBest(ref optim, ref oIndex, routes, leng); Debug(routes); @@ -88,17 +94,17 @@ namespace komvo char[] ch = rts[i].ToString().ToCharArray(); for (int j = 0; j < ch.Length; j++) { - int db = int.Parse(ch[j].ToString()) - 2; //debug + int db = int.Parse(ch[j].ToString()) - 1; //debug string db1 = rts[i].ToString(); //debug - if (j == 0) res += mtr[0, int.Parse(ch[j].ToString()) - 2]; + if (j == 0) res += mtr[0, int.Parse(ch[j].ToString()) - 1]; else if (j == ch.Length - 1) { - res += mtr[int.Parse(ch[j - 1].ToString()) - 2, int.Parse(ch[j].ToString()) - 2]; - res += mtr[0, int.Parse(ch[j].ToString()) - 2]; + res += mtr[int.Parse(ch[j - 1].ToString()) - 1, int.Parse(ch[j].ToString()) - 1]; + res += mtr[0, int.Parse(ch[j].ToString()) - 1]; } else { - res += mtr[int.Parse(ch[j - 1].ToString()) - 2, int.Parse(ch[j].ToString()) - 2]; + res += mtr[int.Parse(ch[j - 1].ToString()) - 1, int.Parse(ch[j].ToString()) - 1]; } } result[i] = res; diff --git a/comivoyar/bin/Debug/comivoyar.exe b/comivoyar/bin/Debug/comivoyar.exe index 7668129..f3917ba 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 df10e14..0773888 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 f0b2693..a576544 100644 --- a/comivoyar/bin/Debug/coord.txt +++ b/comivoyar/bin/Debug/coord.txt @@ -1,4 +1,6 @@ 0 0 10 10 20 20 -30 30 \ No newline at end of file +30 30 +40 40 +50 50 \ No newline at end of file diff --git a/comivoyar/obj/Debug/comivoyar.exe b/comivoyar/obj/Debug/comivoyar.exe index 7668129..f3917ba 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 df10e14..0773888 100644 Binary files a/comivoyar/obj/Debug/comivoyar.pdb and b/comivoyar/obj/Debug/comivoyar.pdb differ