Browse Source

Расчёт для 4 и 5 точек

TestMethods
parent
commit
135e2393cd
  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. BIN
      1.bmp
  5. 67
      comivoyar/Program.cs
  6. BIN
      comivoyar/bin/Debug/comivoyar.exe
  7. BIN
      comivoyar/bin/Debug/comivoyar.pdb
  8. 1
      comivoyar/bin/Debug/coord.txt
  9. 2
      comivoyar/obj/Debug/comivoyar.csproj.CoreCompileInputs.cache
  10. 7
      comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt
  11. BIN
      comivoyar/obj/Debug/comivoyar.exe
  12. 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.

BIN
1.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

67
comivoyar/Program.cs

@ -48,9 +48,9 @@ namespace komvo
} }
for (int i = 0; i < 4; i++) for (int i = 0; i < matr; i++)
{ {
for (int j = 0; j < 4; j++) Write("{0:00.00} ", Matrix[i, j]); for (int j = 0; j < matr; j++) Write("{0:00.00} ", Matrix[i, j]);
WriteLine(); WriteLine();
} }
@ -65,16 +65,32 @@ namespace komvo
int[] routes = new int[Fact(Points.Count - 1)]; int[] routes = new int[Fact(Points.Count - 1)];
double[] leng = new double[Fact(Points.Count - 1)]; double[] leng = new double[Fact(Points.Count - 1)];
int begin = int.Parse(formP), end = int.Parse(formN); int waves = 0;
for (int b = begin; b <= 234; b++) if (Points.Count == 4) waves = 1;
else if (Points.Count == 5) waves = 4;
else if (Points.Count == 6) waves = 20;
string inf = formP;
for (int i = 0; i < waves; i++)
{ {
string number = b.ToString(); for(int j = 0; j < 6; j++)
routes[0] = int.Parse(number); {
routes[1] = int.Parse(Swap(number, 1, 2)); if (i == 0 && j == 0) routes[j + i * 6] = int.Parse(formP);
routes[2] = int.Parse(number = Swap(number, 0, 1)); else if (j % 2 == 0) routes[j + i * 6] = int.Parse(formP = Swap(formP, 0, j / 2));
routes[3] = int.Parse(Swap(number, 1, 2)); else routes[j + i * 6] = int.Parse(Swap(formP, 1, 2));
routes[4] = int.Parse(number = Swap(number, 0, 2)); }
routes[5] = int.Parse(Swap(number, 1, 2)); if (waves > 1) formP = Swap(inf, 0, 3);
//routes[0] = int.Parse(formP);
//routes[1] = int.Parse(Swap(formP, 1, 2));
//routes[2] = int.Parse(formP = Swap(formP, 0, 1));
//routes[3] = int.Parse(Swap(formP, 1, 2));
//routes[4] = int.Parse(formP = Swap(formP, 0, 2));
//routes[5] = int.Parse(Swap(formP, 1, 2));
@ -115,13 +131,24 @@ namespace komvo
leng[i] = res; leng[i] = res;
} }
for (int i = 0; i < leng.Length; i++) WriteLine("{0:N2}", leng[i]); double optim = leng[0];
int oIndex = 0;
for (int i = 0; i < leng.Length; i++)
{
WriteLine("{0:N2}", leng[i]);
if (optim > leng[i])
{
optim = leng[i];
oIndex = i;
}
}
WriteLine("1{1}1 - оптимальный маршрут длинной {0:00.00}", optim, routes[oIndex]);
//WriteLine(routes[0]); //WriteLine(Fact(5));
//MessageBox.Show(Math.Sqrt(-1).ToString()); //MessageBox.Show(Math.Sqrt(-1).ToString());
ReadKey(); ReadKey();
@ -138,21 +165,13 @@ namespace komvo
} }
static public int Fact(int nm)
{
int res = 1;
for (int i = 1; i <= nm; i++)
{
res *= i;
}
return res;
}
public partial struct point public partial struct point
{ {
public int X { get; set; } public int X { get; set; }
public int Y { get; set; } public int Y { get; set; }
} }
static int Fact(int a) => a <= 1 ? 1 : a * Fact(a - 1);
} }
} }

BIN
comivoyar/bin/Debug/comivoyar.exe

Binary file not shown.

BIN
comivoyar/bin/Debug/comivoyar.pdb

Binary file not shown.

1
comivoyar/bin/Debug/coord.txt

@ -2,3 +2,4 @@
20 50 20 50
10 23 10 23
35 32 35 32
25 25

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

@ -1 +1 @@
a325577e7d0bb098d5c8871f5acaa6c0c34b21c6 6eed873852f8ce9c50ebe974dac1f20cc4ef270e

7
comivoyar/obj/Debug/comivoyar.csproj.FileListAbsolute.txt

@ -5,3 +5,10 @@ E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csprojAssemblyReference
E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csproj.CoreCompileInputs.cache E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.csproj.CoreCompileInputs.cache
E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.exe E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.exe
E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.pdb E:\кк\прог\comivoyar\comivoyar\obj\Debug\comivoyar.pdb
D:\Git\comvo\comivoyar\bin\Debug\comivoyar.exe.config
D:\Git\comvo\comivoyar\bin\Debug\comivoyar.exe
D:\Git\comvo\comivoyar\bin\Debug\comivoyar.pdb
D:\Git\comvo\comivoyar\obj\Debug\comivoyar.csprojAssemblyReference.cache
D:\Git\comvo\comivoyar\obj\Debug\comivoyar.csproj.CoreCompileInputs.cache
D:\Git\comvo\comivoyar\obj\Debug\comivoyar.exe
D:\Git\comvo\comivoyar\obj\Debug\comivoyar.pdb

BIN
comivoyar/obj/Debug/comivoyar.exe

Binary file not shown.

BIN
comivoyar/obj/Debug/comivoyar.pdb

Binary file not shown.
Loading…
Cancel
Save