Browse Source

19.10.18 Count2

master
parent
commit
ff4754a133
  1. BIN
      .vs/comivoyar/v15/.suo
  2. BIN
      .vs/comivoyar/v15/Server/sqlite3/storage.ide-shm
  3. BIN
      .vs/comivoyar/v15/Server/sqlite3/storage.ide-wal
  4. 60
      comivoyar/Program.cs
  5. BIN
      comivoyar/bin/Debug/comivoyar.exe
  6. BIN
      comivoyar/bin/Debug/comivoyar.pdb
  7. 12
      comivoyar/bin/Debug/coord.txt
  8. BIN
      comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  9. 2
      comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache
  10. 20
      comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt
  11. BIN
      comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache
  12. BIN
      comivoyar/obj/Debug/comivoyar.exe
  13. BIN
      comivoyar/obj/Debug/comivoyar.pdb

BIN
.vs/comivoyar/v15/.suo

Binary file not shown.

BIN
.vs/comivoyar/v15/Server/sqlite3/storage.ide-shm

Binary file not shown.

BIN
.vs/comivoyar/v15/Server/sqlite3/storage.ide-wal

Binary file not shown.

60
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 - 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 fct = Fact(Points.Count - 1);
int[] routes = new int[fct]; string[] routes = new string[fct];
double[] leng = new double[fct]; double[] leng = new double[fct];
double optim = leng[0]; double optim = leng[0];
@ -64,19 +64,20 @@ namespace komvo
foreach(IList<int> p in perm) foreach(IList<int> p in perm)
{ {
string res = string.Empty; string res = string.Empty;
for (int i = 0; i < toSwap.Length; i++) res += p[i].ToString(); for (int i = 0; i < toSwap.Length; i++) res += p[i].ToString() + ";";
routes[index++] = int.Parse(res); 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); SearchBest(ref optim, ref oIndex, routes, leng);
Debug(routes); //Debug(routes);
WriteLine("\n\n1{1}1 - оптимальный маршрут длинной {0:00.00}\nВсего маршрутов {2}\n{4} {3}", WriteLine("\n\n1{1}1 - оптимальный маршрут длинной {0:00.00}\nВсего маршрутов {2}\n{4} {3}",
optim, routes[oIndex], routes.Length, fct, Points.Count); optim, routes[oIndex], routes.Length, fct, Points.Count);
@ -86,12 +87,47 @@ namespace komvo
ReadKey(); 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++) for (int i = 0; i < rts.Length; i++)
{ {
double res = 0; double res = 0;
char[] ch = rts[i].ToString().ToCharArray(); char[] ch = rts[i].ToCharArray();
for (int j = 0; j < ch.Length; j++) for (int j = 0; j < ch.Length; j++)
{ {
int db = int.Parse(ch[j].ToString()) - 1; //debug 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]; optim = leng[0];
oIndex = 0; oIndex = 0;
for (int i = 0; i < leng.Length; i++) 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]) if (optim > leng[i])
{ {
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++) for (int i = 0; i < routes.Length; i++)
{ {

BIN
comivoyar/bin/Debug/comivoyar.exe

Binary file not shown.

BIN
comivoyar/bin/Debug/comivoyar.pdb

Binary file not shown.

12
comivoyar/bin/Debug/coord.txt

@ -1,6 +1,10 @@
0 0 0 0
10 10 10 10
20 20 30 20
30 30 20 30
40 40 10 40
50 50 20 50
10 60
50 70
20 80
30 100

BIN
comivoyar/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache

Binary file not shown.

2
comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache

@ -1 +1 @@
47ece507326a3ff73baa3b75434a7d03f71dc86d f0bb9fd207d6bf2b73407612668fe4a2e047ddf3

20
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\Combinatorics.xml
E:\кк\прог\comivoyar\comivoyar\bin\Debug\System.Diagnostics.DiagnosticSource.xml E:\кк\прог\comivoyar\comivoyar\bin\Debug\System.Diagnostics.DiagnosticSource.xml
E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csproj.CopyComplete 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

BIN
comivoyar/obj/Debug/comivoyar.csprojAssemblyReference.cache

Binary file not shown.

BIN
comivoyar/obj/Debug/comivoyar.exe

Binary file not shown.

BIN
comivoyar/obj/Debug/comivoyar.pdb

Binary file not shown.
Loading…
Cancel
Save